| 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/ic/handler-compiler.h" | 12 #include "src/ic/handler-compiler.h" |
| 13 #include "src/macro-assembler.h" | 13 #include "src/macro-assembler.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 | |
| 23 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() | 19 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() |
| 24 : stack_parameter_count_(no_reg), | 20 : stack_parameter_count_(no_reg), |
| 25 hint_stack_parameter_count_(-1), | 21 hint_stack_parameter_count_(-1), |
| 26 function_mode_(NOT_JS_FUNCTION_STUB_MODE), | 22 function_mode_(NOT_JS_FUNCTION_STUB_MODE), |
| 27 deoptimization_handler_(NULL), | 23 deoptimization_handler_(NULL), |
| 28 handler_arguments_mode_(DONT_PASS_ARGUMENTS), | 24 handler_arguments_mode_(DONT_PASS_ARGUMENTS), |
| 29 miss_handler_(), | 25 miss_handler_(), |
| 30 has_miss_handler_(false) { } | 26 has_miss_handler_(false) { } |
| 31 | 27 |
| 32 | 28 |
| 33 void InterfaceDescriptor::Initialize( | |
| 34 int register_parameter_count, | |
| 35 Register* registers, | |
| 36 Representation* register_param_representations, | |
| 37 PlatformInterfaceDescriptor* platform_descriptor) { | |
| 38 platform_specific_descriptor_ = platform_descriptor; | |
| 39 register_param_count_ = register_parameter_count; | |
| 40 | |
| 41 // An interface descriptor must have a context register. | |
| 42 DCHECK(register_parameter_count > 0 && registers[0].is(ContextRegister())); | |
| 43 | |
| 44 // InterfaceDescriptor owns a copy of the registers array. | |
| 45 register_params_.Reset(NewArray<Register>(register_parameter_count)); | |
| 46 for (int i = 0; i < register_parameter_count; i++) { | |
| 47 register_params_[i] = registers[i]; | |
| 48 } | |
| 49 | |
| 50 // If a representations array is specified, then the descriptor owns that as | |
| 51 // well. | |
| 52 if (register_param_representations != NULL) { | |
| 53 register_param_representations_.Reset( | |
| 54 NewArray<Representation>(register_parameter_count)); | |
| 55 for (int i = 0; i < register_parameter_count; i++) { | |
| 56 // If there is a context register, the representation must be tagged. | |
| 57 DCHECK(i != 0 || register_param_representations[i].Equals( | |
| 58 Representation::Tagged())); | |
| 59 register_param_representations_[i] = register_param_representations[i]; | |
| 60 } | |
| 61 } | |
| 62 } | |
| 63 | |
| 64 | |
| 65 void CodeStubInterfaceDescriptor::Initialize( | 29 void CodeStubInterfaceDescriptor::Initialize( |
| 66 CodeStub::Major major, int register_parameter_count, Register* registers, | 30 CodeStub::Major major, int register_parameter_count, Register* registers, |
| 67 Address deoptimization_handler, | 31 Address deoptimization_handler, |
| 68 Representation* register_param_representations, | 32 Representation* register_param_representations, |
| 69 int hint_stack_parameter_count, StubFunctionMode function_mode) { | 33 int hint_stack_parameter_count, StubFunctionMode function_mode) { |
| 70 InterfaceDescriptor::Initialize(register_parameter_count, registers, | 34 InterfaceDescriptor::Initialize(register_parameter_count, registers, |
| 71 register_param_representations); | 35 register_param_representations); |
| 72 | 36 |
| 73 deoptimization_handler_ = deoptimization_handler; | 37 deoptimization_handler_ = deoptimization_handler; |
| 74 | 38 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 85 int hint_stack_parameter_count, StubFunctionMode function_mode, | 49 int hint_stack_parameter_count, StubFunctionMode function_mode, |
| 86 HandlerArgumentsMode handler_mode) { | 50 HandlerArgumentsMode handler_mode) { |
| 87 Initialize(major, register_parameter_count, registers, deoptimization_handler, | 51 Initialize(major, register_parameter_count, registers, deoptimization_handler, |
| 88 register_param_representations, hint_stack_parameter_count, | 52 register_param_representations, hint_stack_parameter_count, |
| 89 function_mode); | 53 function_mode); |
| 90 stack_parameter_count_ = stack_parameter_count; | 54 stack_parameter_count_ = stack_parameter_count; |
| 91 handler_arguments_mode_ = handler_mode; | 55 handler_arguments_mode_ = handler_mode; |
| 92 } | 56 } |
| 93 | 57 |
| 94 | 58 |
| 95 void CallInterfaceDescriptor::Initialize( | |
| 96 int register_parameter_count, | |
| 97 Register* registers, | |
| 98 Representation* param_representations, | |
| 99 PlatformInterfaceDescriptor* platform_descriptor) { | |
| 100 InterfaceDescriptor::Initialize(register_parameter_count, registers, | |
| 101 param_representations, platform_descriptor); | |
| 102 } | |
| 103 | |
| 104 | |
| 105 bool CodeStub::FindCodeInCache(Code** code_out) { | 59 bool CodeStub::FindCodeInCache(Code** code_out) { |
| 106 UnseededNumberDictionary* stubs = isolate()->heap()->code_stubs(); | 60 UnseededNumberDictionary* stubs = isolate()->heap()->code_stubs(); |
| 107 int index = stubs->FindEntry(GetKey()); | 61 int index = stubs->FindEntry(GetKey()); |
| 108 if (index != UnseededNumberDictionary::kNotFound) { | 62 if (index != UnseededNumberDictionary::kNotFound) { |
| 109 *code_out = Code::cast(stubs->ValueAt(index)); | 63 *code_out = Code::cast(stubs->ValueAt(index)); |
| 110 return true; | 64 return true; |
| 111 } | 65 } |
| 112 return false; | 66 return false; |
| 113 } | 67 } |
| 114 | 68 |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 InstallDescriptor(isolate, &stub3); | 989 InstallDescriptor(isolate, &stub3); |
| 1036 } | 990 } |
| 1037 | 991 |
| 1038 InternalArrayConstructorStub::InternalArrayConstructorStub( | 992 InternalArrayConstructorStub::InternalArrayConstructorStub( |
| 1039 Isolate* isolate) : PlatformCodeStub(isolate) { | 993 Isolate* isolate) : PlatformCodeStub(isolate) { |
| 1040 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 994 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 1041 } | 995 } |
| 1042 | 996 |
| 1043 | 997 |
| 1044 } } // namespace v8::internal | 998 } } // namespace v8::internal |
| OLD | NEW |