OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 LoadStubCompiler compiler(isolate_); | 164 LoadStubCompiler compiler(isolate_); |
165 Handle<Code> code = | 165 Handle<Code> code = |
166 compiler.CompileLoadCallback(name, receiver, holder, callback); | 166 compiler.CompileLoadCallback(name, receiver, holder, callback); |
167 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); | 167 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
168 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); | 168 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
169 JSObject::UpdateMapCodeCache(receiver, name, code); | 169 JSObject::UpdateMapCodeCache(receiver, name, code); |
170 return code; | 170 return code; |
171 } | 171 } |
172 | 172 |
173 | 173 |
| 174 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<String> name, |
| 175 Handle<JSObject> receiver, |
| 176 Handle<JSObject> holder, |
| 177 Handle<JSFunction> getter) { |
| 178 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
| 179 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, CALLBACKS); |
| 180 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
| 181 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 182 |
| 183 LoadStubCompiler compiler(isolate_); |
| 184 Handle<Code> code = |
| 185 compiler.CompileLoadViaGetter(name, receiver, holder, getter); |
| 186 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
| 187 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
| 188 JSObject::UpdateMapCodeCache(receiver, name, code); |
| 189 return code; |
| 190 } |
| 191 |
| 192 |
174 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name, | 193 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name, |
175 Handle<JSObject> receiver, | 194 Handle<JSObject> receiver, |
176 Handle<JSObject> holder, | 195 Handle<JSObject> holder, |
177 Handle<JSFunction> value) { | 196 Handle<JSFunction> value) { |
178 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 197 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
179 Code::Flags flags = | 198 Code::Flags flags = |
180 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION); | 199 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION); |
181 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 200 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
182 if (probe->IsCode()) return Handle<Code>::cast(probe); | 201 if (probe->IsCode()) return Handle<Code>::cast(probe); |
183 | 202 |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 Handle<FunctionTemplateInfo>( | 1546 Handle<FunctionTemplateInfo>( |
1528 FunctionTemplateInfo::cast(signature->receiver())); | 1547 FunctionTemplateInfo::cast(signature->receiver())); |
1529 } | 1548 } |
1530 } | 1549 } |
1531 | 1550 |
1532 is_simple_api_call_ = true; | 1551 is_simple_api_call_ = true; |
1533 } | 1552 } |
1534 | 1553 |
1535 | 1554 |
1536 } } // namespace v8::internal | 1555 } } // namespace v8::internal |
OLD | NEW |