| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/ast.h" | 9 #include "src/ast.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 Handle<Map> current_map = stub_holder_map; | 188 Handle<Map> current_map = stub_holder_map; |
| 189 Handle<JSObject> last(JSObject::cast(receiver_map->prototype())); | 189 Handle<JSObject> last(JSObject::cast(receiver_map->prototype())); |
| 190 while (true) { | 190 while (true) { |
| 191 if (current_map->is_dictionary_map()) cache_name = name; | 191 if (current_map->is_dictionary_map()) cache_name = name; |
| 192 if (current_map->prototype()->IsNull()) break; | 192 if (current_map->prototype()->IsNull()) break; |
| 193 last = handle(JSObject::cast(current_map->prototype())); | 193 last = handle(JSObject::cast(current_map->prototype())); |
| 194 current_map = handle(last->map()); | 194 current_map = handle(last->map()); |
| 195 } | 195 } |
| 196 // Compile the stub that is either shared for all names or | 196 // Compile the stub that is either shared for all names or |
| 197 // name specific if there are global objects involved. | 197 // name specific if there are global objects involved. |
| 198 Code::Kind handler_kind = Code::LOAD_IC; | |
| 199 Handle<Code> handler = PropertyHandlerCompiler::Find( | 198 Handle<Code> handler = PropertyHandlerCompiler::Find( |
| 200 cache_name, stub_holder_map, handler_kind, flag, Code::FAST); | 199 cache_name, stub_holder_map, Code::LOAD_IC, flag, Code::FAST); |
| 201 if (!handler.is_null()) return handler; | 200 if (!handler.is_null()) return handler; |
| 202 | 201 |
| 203 NamedLoadHandlerCompiler compiler(isolate_, handler_kind, kNoExtraICState, | 202 NamedLoadHandlerCompiler compiler(isolate_, flag); |
| 204 flag); | |
| 205 handler = compiler.CompileLoadNonexistent(type, last, cache_name); | 203 handler = compiler.CompileLoadNonexistent(type, last, cache_name); |
| 206 Map::UpdateCodeCache(stub_holder_map, cache_name, handler); | 204 Map::UpdateCodeCache(stub_holder_map, cache_name, handler); |
| 207 return handler; | 205 return handler; |
| 208 } | 206 } |
| 209 | 207 |
| 210 | 208 |
| 211 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { | 209 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { |
| 212 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC); | 210 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC); |
| 213 Handle<Name> name = | 211 Handle<Name> name = |
| 214 isolate()->factory()->KeyedLoadElementMonomorphic_string(); | 212 isolate()->factory()->KeyedLoadElementMonomorphic_string(); |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 ASSERT_EQ(Code::KEYED_STORE_IC, kind); | 1128 ASSERT_EQ(Code::KEYED_STORE_IC, kind); |
| 1131 return keyed_store_calling_convention(); | 1129 return keyed_store_calling_convention(); |
| 1132 } | 1130 } |
| 1133 } | 1131 } |
| 1134 | 1132 |
| 1135 | 1133 |
| 1136 Handle<Code> PropertyICCompiler::GetCode(Code::Kind kind, Code::StubType type, | 1134 Handle<Code> PropertyICCompiler::GetCode(Code::Kind kind, Code::StubType type, |
| 1137 Handle<Name> name, | 1135 Handle<Name> name, |
| 1138 InlineCacheState state) { | 1136 InlineCacheState state) { |
| 1139 Code::Flags flags = | 1137 Code::Flags flags = |
| 1140 Code::ComputeFlags(kind, state, extra_state(), type, cache_holder()); | 1138 Code::ComputeFlags(kind, state, extra_ic_state_, type, cache_holder()); |
| 1141 Handle<Code> code = GetCodeWithFlags(flags, name); | 1139 Handle<Code> code = GetCodeWithFlags(flags, name); |
| 1142 IC::RegisterWeakMapDependency(code); | 1140 IC::RegisterWeakMapDependency(code); |
| 1143 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); | 1141 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); |
| 1144 return code; | 1142 return code; |
| 1145 } | 1143 } |
| 1146 | 1144 |
| 1147 | 1145 |
| 1148 Handle<Code> PropertyHandlerCompiler::GetCode(Code::Kind kind, | 1146 Handle<Code> PropertyHandlerCompiler::GetCode(Code::Kind kind, |
| 1149 Code::StubType type, | 1147 Code::StubType type, |
| 1150 Handle<Name> name) { | 1148 Handle<Name> name) { |
| 1151 ASSERT_EQ(kNoExtraICState, extra_state()); | |
| 1152 Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder()); | 1149 Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder()); |
| 1153 Handle<Code> code = GetCodeWithFlags(flags, name); | 1150 Handle<Code> code = GetCodeWithFlags(flags, name); |
| 1154 PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, *code, *name)); | 1151 PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, *code, *name)); |
| 1155 return code; | 1152 return code; |
| 1156 } | 1153 } |
| 1157 | 1154 |
| 1158 | 1155 |
| 1159 void IndexedHandlerCompiler::CompileElementHandlers( | 1156 void IndexedHandlerCompiler::CompileElementHandlers( |
| 1160 MapHandleList* receiver_maps, CodeHandleList* handlers) { | 1157 MapHandleList* receiver_maps, CodeHandleList* handlers) { |
| 1161 for (int i = 0; i < receiver_maps->length(); ++i) { | 1158 for (int i = 0; i < receiver_maps->length(); ++i) { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 Handle<FunctionTemplateInfo>( | 1355 Handle<FunctionTemplateInfo>( |
| 1359 FunctionTemplateInfo::cast(signature->receiver())); | 1356 FunctionTemplateInfo::cast(signature->receiver())); |
| 1360 } | 1357 } |
| 1361 } | 1358 } |
| 1362 | 1359 |
| 1363 is_simple_api_call_ = true; | 1360 is_simple_api_call_ = true; |
| 1364 } | 1361 } |
| 1365 | 1362 |
| 1366 | 1363 |
| 1367 } } // namespace v8::internal | 1364 } } // namespace v8::internal |
| OLD | NEW |