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 28 matching lines...) Expand all Loading... |
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_(NULL), | 44 stack_parameter_count_(NULL), |
45 hint_stack_parameter_count_(-1), | 45 hint_stack_parameter_count_(-1), |
46 function_mode_(NOT_JS_FUNCTION_STUB_MODE), | 46 function_mode_(NOT_JS_FUNCTION_STUB_MODE), |
47 register_params_(NULL), | 47 register_params_(NULL), |
48 deoptimization_handler_(NULL), | 48 deoptimization_handler_(NULL), |
49 miss_handler_(IC_Utility(IC::kUnreachable), Isolate::Current()), | 49 miss_handler_(), |
50 has_miss_handler_(false) { } | 50 has_miss_handler_(false) { } |
51 | 51 |
52 | 52 |
53 bool CodeStub::FindCodeInCache(Code** code_out, Isolate* isolate) { | 53 bool CodeStub::FindCodeInCache(Code** code_out, Isolate* isolate) { |
54 UnseededNumberDictionary* stubs = isolate->heap()->code_stubs(); | 54 UnseededNumberDictionary* stubs = isolate->heap()->code_stubs(); |
55 int index = stubs->FindEntry(GetKey()); | 55 int index = stubs->FindEntry(GetKey()); |
56 if (index != UnseededNumberDictionary::kNotFound) { | 56 if (index != UnseededNumberDictionary::kNotFound) { |
57 *code_out = Code::cast(stubs->ValueAt(index)); | 57 *code_out = Code::cast(stubs->ValueAt(index)); |
58 return true; | 58 return true; |
59 } | 59 } |
(...skipping 26 matching lines...) Expand all Loading... |
86 | 86 |
87 | 87 |
88 Handle<Code> CodeStub::GetCodeCopyFromTemplate(Isolate* isolate) { | 88 Handle<Code> CodeStub::GetCodeCopyFromTemplate(Isolate* isolate) { |
89 Handle<Code> ic = GetCode(isolate); | 89 Handle<Code> ic = GetCode(isolate); |
90 ic = isolate->factory()->CopyCode(ic); | 90 ic = isolate->factory()->CopyCode(ic); |
91 RecordCodeGeneration(*ic, isolate); | 91 RecordCodeGeneration(*ic, isolate); |
92 return ic; | 92 return ic; |
93 } | 93 } |
94 | 94 |
95 | 95 |
96 Handle<Code> PlatformCodeStub::GenerateCode() { | 96 Handle<Code> PlatformCodeStub::GenerateCode(Isolate* isolate) { |
97 Isolate* isolate = Isolate::Current(); | |
98 Factory* factory = isolate->factory(); | 97 Factory* factory = isolate->factory(); |
99 | 98 |
100 // Generate the new code. | 99 // Generate the new code. |
101 MacroAssembler masm(isolate, NULL, 256); | 100 MacroAssembler masm(isolate, NULL, 256); |
102 | 101 |
103 { | 102 { |
104 // Update the static counter each time a new code stub is generated. | 103 // Update the static counter each time a new code stub is generated. |
105 isolate->counters()->code_stubs()->Increment(); | 104 isolate->counters()->code_stubs()->Increment(); |
106 | 105 |
107 // Nested stubs are not allowed for leaves. | 106 // Nested stubs are not allowed for leaves. |
(...skipping 29 matching lines...) Expand all Loading... |
137 if (UseSpecialCache() | 136 if (UseSpecialCache() |
138 ? FindCodeInSpecialCache(&code, isolate) | 137 ? FindCodeInSpecialCache(&code, isolate) |
139 : FindCodeInCache(&code, isolate)) { | 138 : FindCodeInCache(&code, isolate)) { |
140 ASSERT(IsPregenerated() == code->is_pregenerated()); | 139 ASSERT(IsPregenerated() == code->is_pregenerated()); |
141 return Handle<Code>(code); | 140 return Handle<Code>(code); |
142 } | 141 } |
143 | 142 |
144 { | 143 { |
145 HandleScope scope(isolate); | 144 HandleScope scope(isolate); |
146 | 145 |
147 Handle<Code> new_object = GenerateCode(); | 146 Handle<Code> new_object = GenerateCode(isolate); |
148 new_object->set_major_key(MajorKey()); | 147 new_object->set_major_key(MajorKey()); |
149 FinishCode(new_object); | 148 FinishCode(new_object); |
150 RecordCodeGeneration(*new_object, isolate); | 149 RecordCodeGeneration(*new_object, isolate); |
151 | 150 |
152 #ifdef ENABLE_DISASSEMBLER | 151 #ifdef ENABLE_DISASSEMBLER |
153 if (FLAG_print_code_stubs) { | 152 if (FLAG_print_code_stubs) { |
154 new_object->Disassemble(*GetName()); | 153 new_object->Disassemble(*GetName()); |
155 PrintF("\n"); | 154 PrintF("\n"); |
156 } | 155 } |
157 #endif | 156 #endif |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 InstallDescriptor(isolate, &stub3); | 794 InstallDescriptor(isolate, &stub3); |
796 } | 795 } |
797 | 796 |
798 InternalArrayConstructorStub::InternalArrayConstructorStub( | 797 InternalArrayConstructorStub::InternalArrayConstructorStub( |
799 Isolate* isolate) { | 798 Isolate* isolate) { |
800 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 799 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
801 } | 800 } |
802 | 801 |
803 | 802 |
804 } } // namespace v8::internal | 803 } } // namespace v8::internal |
OLD | NEW |