Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: src/code-stubs.cc

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25 matching lines...) Expand all
36 #include "macro-assembler.h" 36 #include "macro-assembler.h"
37 37
38 namespace v8 { 38 namespace v8 {
39 namespace internal { 39 namespace internal {
40 40
41 41
42 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() 42 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor()
43 : register_param_count_(-1), 43 : register_param_count_(-1),
44 stack_parameter_count_(no_reg), 44 stack_parameter_count_(no_reg),
45 hint_stack_parameter_count_(-1), 45 hint_stack_parameter_count_(-1),
46 continuation_type_(NORMAL_CONTINUATION),
47 function_mode_(NOT_JS_FUNCTION_STUB_MODE), 46 function_mode_(NOT_JS_FUNCTION_STUB_MODE),
48 register_params_(NULL), 47 register_params_(NULL),
49 deoptimization_handler_(NULL), 48 deoptimization_handler_(NULL),
50 handler_arguments_mode_(DONT_PASS_ARGUMENTS), 49 handler_arguments_mode_(DONT_PASS_ARGUMENTS),
51 miss_handler_(), 50 miss_handler_(),
52 has_miss_handler_(false) { } 51 has_miss_handler_(false) { }
53 52
54 53
55 void CodeStub::GenerateStubsRequiringBuiltinsAheadOfTime(Isolate* isolate) {
56 StubFailureTailCallTrampolineStub::GenerateAheadOfTime(isolate);
57 }
58
59
60 bool CodeStub::FindCodeInCache(Code** code_out, Isolate* isolate) { 54 bool CodeStub::FindCodeInCache(Code** code_out, Isolate* isolate) {
61 UnseededNumberDictionary* stubs = isolate->heap()->code_stubs(); 55 UnseededNumberDictionary* stubs = isolate->heap()->code_stubs();
62 int index = stubs->FindEntry(GetKey()); 56 int index = stubs->FindEntry(GetKey());
63 if (index != UnseededNumberDictionary::kNotFound) { 57 if (index != UnseededNumberDictionary::kNotFound) {
64 *code_out = Code::cast(stubs->ValueAt(index)); 58 *code_out = Code::cast(stubs->ValueAt(index));
65 return true; 59 return true;
66 } 60 }
67 return false; 61 return false;
68 } 62 }
69 63
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 112
119 // Create the code object. 113 // Create the code object.
120 CodeDesc desc; 114 CodeDesc desc;
121 masm.GetCode(&desc); 115 masm.GetCode(&desc);
122 116
123 // Copy the generated code into a heap object. 117 // Copy the generated code into a heap object.
124 Code::Flags flags = Code::ComputeFlags( 118 Code::Flags flags = Code::ComputeFlags(
125 GetCodeKind(), 119 GetCodeKind(),
126 GetICState(), 120 GetICState(),
127 GetExtraICState(), 121 GetExtraICState(),
128 GetStubType(), 122 GetStubType());
129 GetStubFlags());
130 Handle<Code> new_object = factory->NewCode( 123 Handle<Code> new_object = factory->NewCode(
131 desc, flags, masm.CodeObject(), NeedsImmovableCode()); 124 desc, flags, masm.CodeObject(), NeedsImmovableCode());
132 return new_object; 125 return new_object;
133 } 126 }
134 127
135 128
136 void CodeStub::VerifyPlatformFeatures(Isolate* isolate) { 129 void CodeStub::VerifyPlatformFeatures(Isolate* isolate) {
137 ASSERT(CpuFeatures::VerifyCrossCompiling()); 130 ASSERT(CpuFeatures::VerifyCrossCompiling());
138 } 131 }
139 132
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // static 255 // static
263 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime( 256 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(
264 Isolate* isolate, const BinaryOpIC::State& state) { 257 Isolate* isolate, const BinaryOpIC::State& state) {
265 if (state.CouldCreateAllocationMementos()) { 258 if (state.CouldCreateAllocationMementos()) {
266 BinaryOpICWithAllocationSiteStub stub(state); 259 BinaryOpICWithAllocationSiteStub stub(state);
267 stub.GetCode(isolate); 260 stub.GetCode(isolate);
268 } 261 }
269 } 262 }
270 263
271 264
272 void NewStringAddStub::PrintBaseName(StringStream* stream) { 265 void StringAddStub::PrintBaseName(StringStream* stream) {
273 stream->Add("NewStringAddStub"); 266 stream->Add("StringAddStub");
274 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { 267 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) {
275 stream->Add("_CheckBoth"); 268 stream->Add("_CheckBoth");
276 } else if ((flags() & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { 269 } else if ((flags() & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) {
277 stream->Add("_CheckLeft"); 270 stream->Add("_CheckLeft");
278 } else if ((flags() & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { 271 } else if ((flags() & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) {
279 stream->Add("_CheckRight"); 272 stream->Add("_CheckRight");
280 } 273 }
281 if (pretenure_flag() == TENURED) { 274 if (pretenure_flag() == TENURED) {
282 stream->Add("_Tenured"); 275 stream->Add("_Tenured");
283 } 276 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 SimpleListPrinter printer(stream); 462 SimpleListPrinter printer(stream);
470 if (IsEmpty()) printer.Add("None"); 463 if (IsEmpty()) printer.Add("None");
471 if (Contains(UNDEFINED)) printer.Add("Undefined"); 464 if (Contains(UNDEFINED)) printer.Add("Undefined");
472 if (Contains(NULL_TYPE)) printer.Add("Null"); 465 if (Contains(NULL_TYPE)) printer.Add("Null");
473 if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap"); 466 if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap");
474 if (Contains(GENERIC)) printer.Add("Generic"); 467 if (Contains(GENERIC)) printer.Add("Generic");
475 stream->Add(")"); 468 stream->Add(")");
476 } 469 }
477 470
478 471
479 Handle<Type> CompareNilICStub::GetType( 472 Type* CompareNilICStub::GetType(Zone* zone, Handle<Map> map) {
480 Isolate* isolate,
481 Handle<Map> map) {
482 if (state_.Contains(CompareNilICStub::GENERIC)) { 473 if (state_.Contains(CompareNilICStub::GENERIC)) {
483 return Type::Any(isolate); 474 return Type::Any(zone);
484 } 475 }
485 476
486 Handle<Type> result = Type::None(isolate); 477 Type* result = Type::None(zone);
487 if (state_.Contains(CompareNilICStub::UNDEFINED)) { 478 if (state_.Contains(CompareNilICStub::UNDEFINED)) {
488 result = Type::Union(result, Type::Undefined(isolate), isolate); 479 result = Type::Union(result, Type::Undefined(zone), zone);
489 } 480 }
490 if (state_.Contains(CompareNilICStub::NULL_TYPE)) { 481 if (state_.Contains(CompareNilICStub::NULL_TYPE)) {
491 result = Type::Union(result, Type::Null(isolate), isolate); 482 result = Type::Union(result, Type::Null(zone), zone);
492 } 483 }
493 if (state_.Contains(CompareNilICStub::MONOMORPHIC_MAP)) { 484 if (state_.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
494 Handle<Type> type = map.is_null() 485 Type* type =
495 ? Type::Detectable(isolate) : Type::Class(map, isolate); 486 map.is_null() ? Type::Detectable(zone) : Type::Class(map, zone);
496 result = Type::Union(result, type, isolate); 487 result = Type::Union(result, type, zone);
497 } 488 }
498 489
499 return result; 490 return result;
500 } 491 }
501 492
502 493
503 Handle<Type> CompareNilICStub::GetInputType( 494 Type* CompareNilICStub::GetInputType(Zone* zone, Handle<Map> map) {
504 Isolate* isolate, 495 Type* output_type = GetType(zone, map);
505 Handle<Map> map) { 496 Type* nil_type =
506 Handle<Type> output_type = GetType(isolate, map); 497 nil_value_ == kNullValue ? Type::Null(zone) : Type::Undefined(zone);
507 Handle<Type> nil_type = nil_value_ == kNullValue 498 return Type::Union(output_type, nil_type, zone);
508 ? Type::Null(isolate) : Type::Undefined(isolate);
509 return Type::Union(output_type, nil_type, isolate);
510 } 499 }
511 500
512 501
513 void InstanceofStub::PrintName(StringStream* stream) { 502 void InstanceofStub::PrintName(StringStream* stream) {
514 const char* args = ""; 503 const char* args = "";
515 if (HasArgsInRegisters()) { 504 if (HasArgsInRegisters()) {
516 args = "_REGS"; 505 args = "_REGS";
517 } 506 }
518 507
519 const char* inline_check = ""; 508 const char* inline_check = "";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 543
555 544
556 void KeyedStoreElementStub::Generate(MacroAssembler* masm) { 545 void KeyedStoreElementStub::Generate(MacroAssembler* masm) {
557 switch (elements_kind_) { 546 switch (elements_kind_) {
558 case FAST_ELEMENTS: 547 case FAST_ELEMENTS:
559 case FAST_HOLEY_ELEMENTS: 548 case FAST_HOLEY_ELEMENTS:
560 case FAST_SMI_ELEMENTS: 549 case FAST_SMI_ELEMENTS:
561 case FAST_HOLEY_SMI_ELEMENTS: 550 case FAST_HOLEY_SMI_ELEMENTS:
562 case FAST_DOUBLE_ELEMENTS: 551 case FAST_DOUBLE_ELEMENTS:
563 case FAST_HOLEY_DOUBLE_ELEMENTS: 552 case FAST_HOLEY_DOUBLE_ELEMENTS:
564 case EXTERNAL_BYTE_ELEMENTS: 553 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
565 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 554 case EXTERNAL_##TYPE##_ELEMENTS: \
566 case EXTERNAL_SHORT_ELEMENTS: 555 case TYPE##_ELEMENTS:
567 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 556
568 case EXTERNAL_INT_ELEMENTS: 557 TYPED_ARRAYS(TYPED_ARRAY_CASE)
569 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 558 #undef TYPED_ARRAY_CASE
570 case EXTERNAL_FLOAT_ELEMENTS:
571 case EXTERNAL_DOUBLE_ELEMENTS:
572 case EXTERNAL_PIXEL_ELEMENTS:
573 case UINT8_ELEMENTS:
574 case INT8_ELEMENTS:
575 case UINT16_ELEMENTS:
576 case INT16_ELEMENTS:
577 case UINT32_ELEMENTS:
578 case INT32_ELEMENTS:
579 case FLOAT32_ELEMENTS:
580 case FLOAT64_ELEMENTS:
581 case UINT8_CLAMPED_ELEMENTS:
582 UNREACHABLE(); 559 UNREACHABLE();
583 break; 560 break;
584 case DICTIONARY_ELEMENTS: 561 case DICTIONARY_ELEMENTS:
585 KeyedStoreStubCompiler::GenerateStoreDictionaryElement(masm); 562 KeyedStoreStubCompiler::GenerateStoreDictionaryElement(masm);
586 break; 563 break;
587 case NON_STRICT_ARGUMENTS_ELEMENTS: 564 case NON_STRICT_ARGUMENTS_ELEMENTS:
588 UNREACHABLE(); 565 UNREACHABLE();
589 break; 566 break;
590 } 567 }
591 } 568 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 693
717 694
718 void StubFailureTrampolineStub::GenerateAheadOfTime(Isolate* isolate) { 695 void StubFailureTrampolineStub::GenerateAheadOfTime(Isolate* isolate) {
719 StubFailureTrampolineStub stub1(NOT_JS_FUNCTION_STUB_MODE); 696 StubFailureTrampolineStub stub1(NOT_JS_FUNCTION_STUB_MODE);
720 StubFailureTrampolineStub stub2(JS_FUNCTION_STUB_MODE); 697 StubFailureTrampolineStub stub2(JS_FUNCTION_STUB_MODE);
721 stub1.GetCode(isolate); 698 stub1.GetCode(isolate);
722 stub2.GetCode(isolate); 699 stub2.GetCode(isolate);
723 } 700 }
724 701
725 702
726 void StubFailureTailCallTrampolineStub::GenerateAheadOfTime(Isolate* isolate) {
727 StubFailureTailCallTrampolineStub stub;
728 stub.GetCode(isolate);
729 }
730
731
732 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, 703 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function,
733 intptr_t stack_pointer, 704 intptr_t stack_pointer,
734 Isolate* isolate) { 705 Isolate* isolate) {
735 FunctionEntryHook entry_hook = isolate->function_entry_hook(); 706 FunctionEntryHook entry_hook = isolate->function_entry_hook();
736 ASSERT(entry_hook != NULL); 707 ASSERT(entry_hook != NULL);
737 entry_hook(function, stack_pointer); 708 entry_hook(function, stack_pointer);
738 } 709 }
739 710
740 711
741 static void InstallDescriptor(Isolate* isolate, HydrogenCodeStub* stub) { 712 static void InstallDescriptor(Isolate* isolate, HydrogenCodeStub* stub) {
(...skipping 21 matching lines...) Expand all
763 InstallDescriptor(isolate, &stub); 734 InstallDescriptor(isolate, &stub);
764 } 735 }
765 736
766 737
767 void FastNewClosureStub::InstallDescriptors(Isolate* isolate) { 738 void FastNewClosureStub::InstallDescriptors(Isolate* isolate) {
768 FastNewClosureStub stub(STRICT_MODE, false); 739 FastNewClosureStub stub(STRICT_MODE, false);
769 InstallDescriptor(isolate, &stub); 740 InstallDescriptor(isolate, &stub);
770 } 741 }
771 742
772 743
744 void FastNewContextStub::InstallDescriptors(Isolate* isolate) {
745 FastNewContextStub stub(FastNewContextStub::kMaximumSlots);
746 InstallDescriptor(isolate, &stub);
747 }
748
749
750 // static
751 void FastCloneShallowArrayStub::InstallDescriptors(Isolate* isolate) {
752 FastCloneShallowArrayStub stub(FastCloneShallowArrayStub::CLONE_ELEMENTS,
753 DONT_TRACK_ALLOCATION_SITE, 0);
754 InstallDescriptor(isolate, &stub);
755 }
756
757
773 // static 758 // static
774 void BinaryOpICStub::InstallDescriptors(Isolate* isolate) { 759 void BinaryOpICStub::InstallDescriptors(Isolate* isolate) {
775 BinaryOpICStub stub(Token::ADD, NO_OVERWRITE); 760 BinaryOpICStub stub(Token::ADD, NO_OVERWRITE);
776 InstallDescriptor(isolate, &stub); 761 InstallDescriptor(isolate, &stub);
777 } 762 }
778 763
779 764
780 // static 765 // static
781 void BinaryOpWithAllocationSiteStub::InstallDescriptors(Isolate* isolate) { 766 void BinaryOpWithAllocationSiteStub::InstallDescriptors(Isolate* isolate) {
782 BinaryOpWithAllocationSiteStub stub(Token::ADD, NO_OVERWRITE); 767 BinaryOpWithAllocationSiteStub stub(Token::ADD, NO_OVERWRITE);
783 InstallDescriptor(isolate, &stub); 768 InstallDescriptor(isolate, &stub);
784 } 769 }
785 770
786 771
787 // static 772 // static
788 void NewStringAddStub::InstallDescriptors(Isolate* isolate) { 773 void StringAddStub::InstallDescriptors(Isolate* isolate) {
789 NewStringAddStub stub(STRING_ADD_CHECK_NONE, NOT_TENURED); 774 StringAddStub stub(STRING_ADD_CHECK_NONE, NOT_TENURED);
790 InstallDescriptor(isolate, &stub); 775 InstallDescriptor(isolate, &stub);
791 } 776 }
792 777
778
779 // static
780 void RegExpConstructResultStub::InstallDescriptors(Isolate* isolate) {
781 RegExpConstructResultStub stub;
782 InstallDescriptor(isolate, &stub);
783 }
784
793 785
794 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) 786 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
795 : argument_count_(ANY) { 787 : argument_count_(ANY) {
796 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 788 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
797 } 789 }
798 790
799 791
800 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, 792 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate,
801 int argument_count) { 793 int argument_count) {
802 if (argument_count == 0) { 794 if (argument_count == 0) {
(...skipping 18 matching lines...) Expand all
821 InstallDescriptor(isolate, &stub3); 813 InstallDescriptor(isolate, &stub3);
822 } 814 }
823 815
824 InternalArrayConstructorStub::InternalArrayConstructorStub( 816 InternalArrayConstructorStub::InternalArrayConstructorStub(
825 Isolate* isolate) { 817 Isolate* isolate) {
826 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 818 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
827 } 819 }
828 820
829 821
830 } } // namespace v8::internal 822 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698