| 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/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| 11 #include "src/gdb-jit.h" | 11 #include "src/gdb-jit.h" |
| 12 #include "src/macro-assembler.h" | 12 #include "src/macro-assembler.h" |
| 13 #include "src/stub-cache.h" | 13 #include "src/stub-cache.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 | 18 |
| 19 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() | 19 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() |
| 20 : register_param_count_(-1), | 20 : register_param_count_(-1), |
| 21 stack_parameter_count_(no_reg), | 21 stack_parameter_count_(no_reg), |
| 22 hint_stack_parameter_count_(-1), | 22 hint_stack_parameter_count_(-1), |
| 23 function_mode_(NOT_JS_FUNCTION_STUB_MODE), | 23 function_mode_(NOT_JS_FUNCTION_STUB_MODE), |
| 24 register_params_(NULL), | |
| 25 register_param_representations_(NULL), | 24 register_param_representations_(NULL), |
| 26 deoptimization_handler_(NULL), | 25 deoptimization_handler_(NULL), |
| 27 handler_arguments_mode_(DONT_PASS_ARGUMENTS), | 26 handler_arguments_mode_(DONT_PASS_ARGUMENTS), |
| 28 miss_handler_(), | 27 miss_handler_(), |
| 29 has_miss_handler_(false) { } | 28 has_miss_handler_(false) { } |
| 30 | 29 |
| 31 | 30 |
| 31 void CodeStubInterfaceDescriptor::Initialize( |
| 32 int register_parameter_count, |
| 33 Register* registers, |
| 34 Address deoptimization_handler, |
| 35 Representation* register_param_representations, |
| 36 int hint_stack_parameter_count, |
| 37 StubFunctionMode function_mode) { |
| 38 InitializeRegisterParams(register_parameter_count, registers); |
| 39 deoptimization_handler_ = deoptimization_handler; |
| 40 register_param_representations_ = register_param_representations; |
| 41 hint_stack_parameter_count_ = hint_stack_parameter_count; |
| 42 function_mode_ = function_mode; |
| 43 } |
| 44 |
| 45 |
| 46 void CodeStubInterfaceDescriptor::Initialize( |
| 47 int register_parameter_count, |
| 48 Register* registers, |
| 49 Register stack_parameter_count, |
| 50 Address deoptimization_handler, |
| 51 Representation* register_param_representations, |
| 52 int hint_stack_parameter_count, |
| 53 StubFunctionMode function_mode, |
| 54 HandlerArgumentsMode handler_mode) { |
| 55 Initialize(register_parameter_count, registers, |
| 56 deoptimization_handler, |
| 57 register_param_representations, |
| 58 hint_stack_parameter_count, |
| 59 function_mode); |
| 60 stack_parameter_count_ = stack_parameter_count; |
| 61 handler_arguments_mode_ = handler_mode; |
| 62 } |
| 63 |
| 64 |
| 32 bool CodeStub::FindCodeInCache(Code** code_out) { | 65 bool CodeStub::FindCodeInCache(Code** code_out) { |
| 33 UnseededNumberDictionary* stubs = isolate()->heap()->code_stubs(); | 66 UnseededNumberDictionary* stubs = isolate()->heap()->code_stubs(); |
| 34 int index = stubs->FindEntry(GetKey()); | 67 int index = stubs->FindEntry(GetKey()); |
| 35 if (index != UnseededNumberDictionary::kNotFound) { | 68 if (index != UnseededNumberDictionary::kNotFound) { |
| 36 *code_out = Code::cast(stubs->ValueAt(index)); | 69 *code_out = Code::cast(stubs->ValueAt(index)); |
| 37 return true; | 70 return true; |
| 38 } | 71 } |
| 39 return false; | 72 return false; |
| 40 } | 73 } |
| 41 | 74 |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 538 |
| 506 | 539 |
| 507 void JSEntryStub::FinishCode(Handle<Code> code) { | 540 void JSEntryStub::FinishCode(Handle<Code> code) { |
| 508 Handle<FixedArray> handler_table = | 541 Handle<FixedArray> handler_table = |
| 509 code->GetIsolate()->factory()->NewFixedArray(1, TENURED); | 542 code->GetIsolate()->factory()->NewFixedArray(1, TENURED); |
| 510 handler_table->set(0, Smi::FromInt(handler_offset_)); | 543 handler_table->set(0, Smi::FromInt(handler_offset_)); |
| 511 code->set_handler_table(*handler_table); | 544 code->set_handler_table(*handler_table); |
| 512 } | 545 } |
| 513 | 546 |
| 514 | 547 |
| 548 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( |
| 549 CodeStubInterfaceDescriptor* descriptor) { |
| 550 Register registers[] = { KeyedLoadIC::ReceiverRegister(), |
| 551 KeyedLoadIC::NameRegister() }; |
| 552 descriptor->Initialize(KeyedLoadIC::kRegisterArgumentCount, registers, |
| 553 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure)); |
| 554 } |
| 555 |
| 556 |
| 557 void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( |
| 558 CodeStubInterfaceDescriptor* descriptor) { |
| 559 Register registers[] = { KeyedLoadIC::ReceiverRegister(), |
| 560 KeyedLoadIC::NameRegister() }; |
| 561 descriptor->Initialize(KeyedLoadIC::kRegisterArgumentCount, registers, |
| 562 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure)); |
| 563 } |
| 564 |
| 565 |
| 566 void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor( |
| 567 CodeStubInterfaceDescriptor* descriptor) { |
| 568 Register registers[] = { KeyedLoadIC::ReceiverRegister(), |
| 569 KeyedLoadIC::NameRegister() }; |
| 570 descriptor->Initialize( |
| 571 KeyedLoadIC::kRegisterArgumentCount, registers, |
| 572 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry); |
| 573 } |
| 574 |
| 575 |
| 515 void KeyedLoadDictionaryElementPlatformStub::Generate( | 576 void KeyedLoadDictionaryElementPlatformStub::Generate( |
| 516 MacroAssembler* masm) { | 577 MacroAssembler* masm) { |
| 517 KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm); | 578 KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm); |
| 518 } | 579 } |
| 519 | 580 |
| 520 | 581 |
| 521 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { | 582 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
| 522 CreateAllocationSiteStub stub(isolate); | 583 CreateAllocationSiteStub stub(isolate); |
| 523 stub.GetCode(); | 584 stub.GetCode(); |
| 524 } | 585 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 InstallDescriptor(isolate, &stub3); | 863 InstallDescriptor(isolate, &stub3); |
| 803 } | 864 } |
| 804 | 865 |
| 805 InternalArrayConstructorStub::InternalArrayConstructorStub( | 866 InternalArrayConstructorStub::InternalArrayConstructorStub( |
| 806 Isolate* isolate) : PlatformCodeStub(isolate) { | 867 Isolate* isolate) : PlatformCodeStub(isolate) { |
| 807 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 868 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 808 } | 869 } |
| 809 | 870 |
| 810 | 871 |
| 811 } } // namespace v8::internal | 872 } } // namespace v8::internal |
| OLD | NEW |