| 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 JSObject::GetElementWithInterceptor(receiver, receiver, index)); | 600 JSObject::GetElementWithInterceptor(receiver, receiver, index)); |
| 601 return *result; | 601 return *result; |
| 602 } | 602 } |
| 603 | 603 |
| 604 | 604 |
| 605 Handle<Code> StubCompiler::CompileLoadInitialize(Code::Flags flags) { | 605 Handle<Code> StubCompiler::CompileLoadInitialize(Code::Flags flags) { |
| 606 LoadIC::GenerateInitialize(masm()); | 606 LoadIC::GenerateInitialize(masm()); |
| 607 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadInitialize"); | 607 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadInitialize"); |
| 608 PROFILE(isolate(), | 608 PROFILE(isolate(), |
| 609 CodeCreateEvent(Logger::LOAD_INITIALIZE_TAG, *code, 0)); | 609 CodeCreateEvent(Logger::LOAD_INITIALIZE_TAG, *code, 0)); |
| 610 isolate()->CodeCreateEvent(*code, "args_count: 0"); |
| 610 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code)); | 611 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code)); |
| 611 return code; | 612 return code; |
| 612 } | 613 } |
| 613 | 614 |
| 614 | 615 |
| 615 Handle<Code> StubCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { | 616 Handle<Code> StubCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { |
| 616 LoadIC::GeneratePreMonomorphic(masm()); | 617 LoadIC::GeneratePreMonomorphic(masm()); |
| 617 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); | 618 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); |
| 618 PROFILE(isolate(), | 619 PROFILE(isolate(), |
| 619 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); | 620 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); |
| 621 isolate()->CodeCreateEvent(*code, "args_count: 0"); |
| 620 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code)); | 622 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code)); |
| 621 return code; | 623 return code; |
| 622 } | 624 } |
| 623 | 625 |
| 624 | 626 |
| 625 Handle<Code> StubCompiler::CompileLoadMegamorphic(Code::Flags flags) { | 627 Handle<Code> StubCompiler::CompileLoadMegamorphic(Code::Flags flags) { |
| 626 LoadIC::GenerateMegamorphic(masm()); | 628 LoadIC::GenerateMegamorphic(masm()); |
| 627 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadMegamorphic"); | 629 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadMegamorphic"); |
| 628 PROFILE(isolate(), | 630 PROFILE(isolate(), |
| 629 CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0)); | 631 CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0)); |
| 632 isolate()->CodeCreateEvent(*code, "args_count: 0"); |
| 630 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code)); | 633 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code)); |
| 631 return code; | 634 return code; |
| 632 } | 635 } |
| 633 | 636 |
| 634 | 637 |
| 635 Handle<Code> StubCompiler::CompileStoreInitialize(Code::Flags flags) { | 638 Handle<Code> StubCompiler::CompileStoreInitialize(Code::Flags flags) { |
| 636 StoreIC::GenerateInitialize(masm()); | 639 StoreIC::GenerateInitialize(masm()); |
| 637 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); | 640 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); |
| 638 PROFILE(isolate(), | 641 PROFILE(isolate(), |
| 639 CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); | 642 CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); |
| 643 isolate()->CodeCreateEvent(*code, "args_count: 0"); |
| 640 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code)); | 644 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code)); |
| 641 return code; | 645 return code; |
| 642 } | 646 } |
| 643 | 647 |
| 644 | 648 |
| 645 Handle<Code> StubCompiler::CompileStorePreMonomorphic(Code::Flags flags) { | 649 Handle<Code> StubCompiler::CompileStorePreMonomorphic(Code::Flags flags) { |
| 646 StoreIC::GeneratePreMonomorphic(masm()); | 650 StoreIC::GeneratePreMonomorphic(masm()); |
| 647 Handle<Code> code = GetCodeWithFlags(flags, "CompileStorePreMonomorphic"); | 651 Handle<Code> code = GetCodeWithFlags(flags, "CompileStorePreMonomorphic"); |
| 648 PROFILE(isolate(), | 652 PROFILE(isolate(), |
| 649 CodeCreateEvent(Logger::STORE_PREMONOMORPHIC_TAG, *code, 0)); | 653 CodeCreateEvent(Logger::STORE_PREMONOMORPHIC_TAG, *code, 0)); |
| 654 isolate()->CodeCreateEvent(*code, "args_count: 0"); |
| 650 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code)); | 655 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code)); |
| 651 return code; | 656 return code; |
| 652 } | 657 } |
| 653 | 658 |
| 654 | 659 |
| 655 Handle<Code> StubCompiler::CompileStoreGeneric(Code::Flags flags) { | 660 Handle<Code> StubCompiler::CompileStoreGeneric(Code::Flags flags) { |
| 656 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 661 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
| 657 StrictMode strict_mode = StoreIC::GetStrictMode(extra_state); | 662 StrictMode strict_mode = StoreIC::GetStrictMode(extra_state); |
| 658 StoreIC::GenerateRuntimeSetProperty(masm(), strict_mode); | 663 StoreIC::GenerateRuntimeSetProperty(masm(), strict_mode); |
| 659 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric"); | 664 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric"); |
| 660 PROFILE(isolate(), | 665 PROFILE(isolate(), |
| 661 CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0)); | 666 CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0)); |
| 667 isolate()->CodeCreateEvent(*code, "args_count: 0"); |
| 662 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code)); | 668 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code)); |
| 663 return code; | 669 return code; |
| 664 } | 670 } |
| 665 | 671 |
| 666 | 672 |
| 667 Handle<Code> StubCompiler::CompileStoreMegamorphic(Code::Flags flags) { | 673 Handle<Code> StubCompiler::CompileStoreMegamorphic(Code::Flags flags) { |
| 668 StoreIC::GenerateMegamorphic(masm()); | 674 StoreIC::GenerateMegamorphic(masm()); |
| 669 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreMegamorphic"); | 675 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreMegamorphic"); |
| 670 PROFILE(isolate(), | 676 PROFILE(isolate(), |
| 671 CodeCreateEvent(Logger::STORE_MEGAMORPHIC_TAG, *code, 0)); | 677 CodeCreateEvent(Logger::STORE_MEGAMORPHIC_TAG, *code, 0)); |
| 678 isolate()->CodeCreateEvent(*code, "args_count: 0"); |
| 672 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code)); | 679 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code)); |
| 673 return code; | 680 return code; |
| 674 } | 681 } |
| 675 | 682 |
| 676 | 683 |
| 677 #undef CALL_LOGGER_TAG | 684 #undef CALL_LOGGER_TAG |
| 678 | 685 |
| 679 | 686 |
| 680 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags, | 687 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags, |
| 681 const char* name) { | 688 const char* name) { |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 | 1201 |
| 1195 | 1202 |
| 1196 Handle<Code> BaseLoadStoreStubCompiler::GetICCode(Code::Kind kind, | 1203 Handle<Code> BaseLoadStoreStubCompiler::GetICCode(Code::Kind kind, |
| 1197 Code::StubType type, | 1204 Code::StubType type, |
| 1198 Handle<Name> name, | 1205 Handle<Name> name, |
| 1199 InlineCacheState state) { | 1206 InlineCacheState state) { |
| 1200 Code::Flags flags = Code::ComputeFlags(kind, state, extra_state(), type); | 1207 Code::Flags flags = Code::ComputeFlags(kind, state, extra_state(), type); |
| 1201 Handle<Code> code = GetCodeWithFlags(flags, name); | 1208 Handle<Code> code = GetCodeWithFlags(flags, name); |
| 1202 IC::RegisterWeakMapDependency(code); | 1209 IC::RegisterWeakMapDependency(code); |
| 1203 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); | 1210 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); |
| 1211 isolate()->CodeCreateEvent(*code, *name); |
| 1204 JitEvent(name, code); | 1212 JitEvent(name, code); |
| 1205 return code; | 1213 return code; |
| 1206 } | 1214 } |
| 1207 | 1215 |
| 1208 | 1216 |
| 1209 Handle<Code> BaseLoadStoreStubCompiler::GetCode(Code::Kind kind, | 1217 Handle<Code> BaseLoadStoreStubCompiler::GetCode(Code::Kind kind, |
| 1210 Code::StubType type, | 1218 Code::StubType type, |
| 1211 Handle<Name> name) { | 1219 Handle<Name> name) { |
| 1212 ASSERT_EQ(kNoExtraICState, extra_state()); | 1220 ASSERT_EQ(kNoExtraICState, extra_state()); |
| 1213 Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder_); | 1221 Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder_); |
| 1214 Handle<Code> code = GetCodeWithFlags(flags, name); | 1222 Handle<Code> code = GetCodeWithFlags(flags, name); |
| 1215 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); | 1223 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); |
| 1224 isolate()->CodeCreateEvent(*code, *name); |
| 1216 JitEvent(name, code); | 1225 JitEvent(name, code); |
| 1217 return code; | 1226 return code; |
| 1218 } | 1227 } |
| 1219 | 1228 |
| 1220 | 1229 |
| 1221 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps, | 1230 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps, |
| 1222 CodeHandleList* handlers) { | 1231 CodeHandleList* handlers) { |
| 1223 for (int i = 0; i < receiver_maps->length(); ++i) { | 1232 for (int i = 0; i < receiver_maps->length(); ++i) { |
| 1224 Handle<Map> receiver_map = receiver_maps->at(i); | 1233 Handle<Map> receiver_map = receiver_maps->at(i); |
| 1225 Handle<Code> cached_stub; | 1234 Handle<Code> cached_stub; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 } | 1308 } |
| 1300 ASSERT(!cached_stub.is_null()); | 1309 ASSERT(!cached_stub.is_null()); |
| 1301 handlers.Add(cached_stub); | 1310 handlers.Add(cached_stub); |
| 1302 transitioned_maps.Add(transitioned_map); | 1311 transitioned_maps.Add(transitioned_map); |
| 1303 } | 1312 } |
| 1304 Handle<Code> code = | 1313 Handle<Code> code = |
| 1305 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); | 1314 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); |
| 1306 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); | 1315 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); |
| 1307 PROFILE(isolate(), | 1316 PROFILE(isolate(), |
| 1308 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0)); | 1317 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0)); |
| 1318 isolate()->CodeCreateEvent(*code, "args_count: 0"); |
| 1309 return code; | 1319 return code; |
| 1310 } | 1320 } |
| 1311 | 1321 |
| 1312 | 1322 |
| 1313 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( | 1323 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( |
| 1314 MacroAssembler* masm) { | 1324 MacroAssembler* masm) { |
| 1315 KeyedStoreIC::GenerateSlow(masm); | 1325 KeyedStoreIC::GenerateSlow(masm); |
| 1316 } | 1326 } |
| 1317 | 1327 |
| 1318 | 1328 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 Handle<FunctionTemplateInfo>( | 1436 Handle<FunctionTemplateInfo>( |
| 1427 FunctionTemplateInfo::cast(signature->receiver())); | 1437 FunctionTemplateInfo::cast(signature->receiver())); |
| 1428 } | 1438 } |
| 1429 } | 1439 } |
| 1430 | 1440 |
| 1431 is_simple_api_call_ = true; | 1441 is_simple_api_call_ = true; |
| 1432 } | 1442 } |
| 1433 | 1443 |
| 1434 | 1444 |
| 1435 } } // namespace v8::internal | 1445 } } // namespace v8::internal |
| OLD | NEW |