| 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 InterfaceDescriptor::InterfaceDescriptor() |
| 20 : register_param_count_(-1) { } |
| 21 |
| 22 |
| 19 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() | 23 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() |
| 20 : register_param_count_(-1), | 24 : stack_parameter_count_(no_reg), |
| 21 stack_parameter_count_(no_reg), | |
| 22 hint_stack_parameter_count_(-1), | 25 hint_stack_parameter_count_(-1), |
| 23 function_mode_(NOT_JS_FUNCTION_STUB_MODE), | 26 function_mode_(NOT_JS_FUNCTION_STUB_MODE), |
| 24 deoptimization_handler_(NULL), | 27 deoptimization_handler_(NULL), |
| 25 handler_arguments_mode_(DONT_PASS_ARGUMENTS), | 28 handler_arguments_mode_(DONT_PASS_ARGUMENTS), |
| 26 miss_handler_(), | 29 miss_handler_(), |
| 27 has_miss_handler_(false) { } | 30 has_miss_handler_(false) { } |
| 28 | 31 |
| 29 | 32 |
| 30 void CodeStubInterfaceDescriptor::Initialize( | 33 void InterfaceDescriptor::Initialize( |
| 31 int register_parameter_count, | 34 int register_parameter_count, |
| 32 Register* registers, | 35 Register* registers, |
| 33 Address deoptimization_handler, | 36 Representation* register_param_representations) { |
| 34 Representation* register_param_representations, | |
| 35 int hint_stack_parameter_count, | |
| 36 StubFunctionMode function_mode) { | |
| 37 // CodeStubInterfaceDescriptor owns a copy of the registers array. | |
| 38 register_param_count_ = register_parameter_count; | 37 register_param_count_ = register_parameter_count; |
| 38 // InterfaceDescriptor owns a copy of the registers array. |
| 39 register_params_.Reset(NewArray<Register>(register_parameter_count)); | 39 register_params_.Reset(NewArray<Register>(register_parameter_count)); |
| 40 for (int i = 0; i < register_parameter_count; i++) { | 40 for (int i = 0; i < register_parameter_count; i++) { |
| 41 // InterfaceDescriptors have an implicit context register. |
| 42 ASSERT(!registers[i].is(ContextRegister())); |
| 41 register_params_[i] = registers[i]; | 43 register_params_[i] = registers[i]; |
| 42 } | 44 } |
| 43 | 45 |
| 44 // If a representations array is specified, then the descriptor owns that as | 46 // If a representations array is specified, then the descriptor owns that as |
| 45 // well. | 47 // well. |
| 46 if (register_param_representations != NULL) { | 48 if (register_param_representations != NULL) { |
| 47 register_param_representations_.Reset( | 49 register_param_representations_.Reset( |
| 48 NewArray<Representation>(register_parameter_count)); | 50 NewArray<Representation>(register_parameter_count)); |
| 49 for (int i = 0; i < register_parameter_count; i++) { | 51 for (int i = 0; i < register_parameter_count; i++) { |
| 50 register_param_representations_[i] = register_param_representations[i]; | 52 register_param_representations_[i] = register_param_representations[i]; |
| 51 } | 53 } |
| 52 } | 54 } |
| 55 } |
| 56 |
| 57 |
| 58 void CodeStubInterfaceDescriptor::Initialize( |
| 59 int register_parameter_count, |
| 60 Register* registers, |
| 61 Address deoptimization_handler, |
| 62 Representation* register_param_representations, |
| 63 int hint_stack_parameter_count, |
| 64 StubFunctionMode function_mode) { |
| 65 InterfaceDescriptor::Initialize(register_parameter_count, registers, |
| 66 register_param_representations); |
| 53 | 67 |
| 54 deoptimization_handler_ = deoptimization_handler; | 68 deoptimization_handler_ = deoptimization_handler; |
| 55 | 69 |
| 56 hint_stack_parameter_count_ = hint_stack_parameter_count; | 70 hint_stack_parameter_count_ = hint_stack_parameter_count; |
| 57 function_mode_ = function_mode; | 71 function_mode_ = function_mode; |
| 58 } | 72 } |
| 59 | 73 |
| 60 | 74 |
| 61 void CodeStubInterfaceDescriptor::Initialize( | 75 void CodeStubInterfaceDescriptor::Initialize( |
| 62 int register_parameter_count, | 76 int register_parameter_count, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 75 stack_parameter_count_ = stack_parameter_count; | 89 stack_parameter_count_ = stack_parameter_count; |
| 76 handler_arguments_mode_ = handler_mode; | 90 handler_arguments_mode_ = handler_mode; |
| 77 } | 91 } |
| 78 | 92 |
| 79 | 93 |
| 80 void CallInterfaceDescriptor::Initialize( | 94 void CallInterfaceDescriptor::Initialize( |
| 81 int register_parameter_count, | 95 int register_parameter_count, |
| 82 Register* registers, | 96 Register* registers, |
| 83 Representation* param_representations, | 97 Representation* param_representations, |
| 84 PlatformCallInterfaceDescriptor* platform_descriptor) { | 98 PlatformCallInterfaceDescriptor* platform_descriptor) { |
| 85 // CallInterfaceDescriptor owns a copy of the registers array. | 99 InterfaceDescriptor::Initialize(register_parameter_count, registers, |
| 86 register_param_count_ = register_parameter_count; | 100 param_representations); |
| 87 register_params_.Reset(NewArray<Register>(register_parameter_count)); | |
| 88 for (int i = 0; i < register_parameter_count; i++) { | |
| 89 register_params_[i] = registers[i]; | |
| 90 } | |
| 91 | |
| 92 // Also the register parameter representations. | |
| 93 param_representations_.Reset( | |
| 94 NewArray<Representation>(register_parameter_count)); | |
| 95 for (int i = 0; i < register_parameter_count; i++) { | |
| 96 param_representations_[i] = param_representations[i]; | |
| 97 } | |
| 98 | 101 |
| 99 platform_specific_descriptor_ = platform_descriptor; | 102 platform_specific_descriptor_ = platform_descriptor; |
| 100 } | 103 } |
| 101 | 104 |
| 102 | 105 |
| 103 bool CodeStub::FindCodeInCache(Code** code_out) { | 106 bool CodeStub::FindCodeInCache(Code** code_out) { |
| 104 UnseededNumberDictionary* stubs = isolate()->heap()->code_stubs(); | 107 UnseededNumberDictionary* stubs = isolate()->heap()->code_stubs(); |
| 105 int index = stubs->FindEntry(GetKey()); | 108 int index = stubs->FindEntry(GetKey()); |
| 106 if (index != UnseededNumberDictionary::kNotFound) { | 109 if (index != UnseededNumberDictionary::kNotFound) { |
| 107 *code_out = Code::cast(stubs->ValueAt(index)); | 110 *code_out = Code::cast(stubs->ValueAt(index)); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 InstallDescriptor(isolate, &stub3); | 964 InstallDescriptor(isolate, &stub3); |
| 962 } | 965 } |
| 963 | 966 |
| 964 InternalArrayConstructorStub::InternalArrayConstructorStub( | 967 InternalArrayConstructorStub::InternalArrayConstructorStub( |
| 965 Isolate* isolate) : PlatformCodeStub(isolate) { | 968 Isolate* isolate) : PlatformCodeStub(isolate) { |
| 966 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 969 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 967 } | 970 } |
| 968 | 971 |
| 969 | 972 |
| 970 } } // namespace v8::internal | 973 } } // namespace v8::internal |
| OLD | NEW |