OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/v8.h" |
| 6 |
| 7 #include "src/interface-descriptors.h" |
| 8 |
| 9 namespace v8 { |
| 10 namespace internal { |
| 11 |
| 12 InterfaceDescriptor::InterfaceDescriptor() : register_param_count_(-1) {} |
| 13 |
| 14 |
| 15 void InterfaceDescriptor::Initialize( |
| 16 int register_parameter_count, Register* registers, |
| 17 Representation* register_param_representations, |
| 18 PlatformInterfaceDescriptor* platform_descriptor) { |
| 19 platform_specific_descriptor_ = platform_descriptor; |
| 20 register_param_count_ = register_parameter_count; |
| 21 |
| 22 // An interface descriptor must have a context register. |
| 23 DCHECK(register_parameter_count > 0 && registers[0].is(ContextRegister())); |
| 24 |
| 25 // InterfaceDescriptor owns a copy of the registers array. |
| 26 register_params_.Reset(NewArray<Register>(register_parameter_count)); |
| 27 for (int i = 0; i < register_parameter_count; i++) { |
| 28 register_params_[i] = registers[i]; |
| 29 } |
| 30 |
| 31 // If a representations array is specified, then the descriptor owns that as |
| 32 // well. |
| 33 if (register_param_representations != NULL) { |
| 34 register_param_representations_.Reset( |
| 35 NewArray<Representation>(register_parameter_count)); |
| 36 for (int i = 0; i < register_parameter_count; i++) { |
| 37 // If there is a context register, the representation must be tagged. |
| 38 DCHECK( |
| 39 i != 0 || |
| 40 register_param_representations[i].Equals(Representation::Tagged())); |
| 41 register_param_representations_[i] = register_param_representations[i]; |
| 42 } |
| 43 } |
| 44 } |
| 45 |
| 46 |
| 47 void CallInterfaceDescriptor::Initialize( |
| 48 int register_parameter_count, Register* registers, |
| 49 Representation* param_representations, |
| 50 PlatformInterfaceDescriptor* platform_descriptor) { |
| 51 InterfaceDescriptor::Initialize(register_parameter_count, registers, |
| 52 param_representations, platform_descriptor); |
| 53 } |
| 54 } |
| 55 } // namespace v8::internal |
OLD | NEW |