Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: src/interface-descriptors.cc

Issue 527093002: Make concrete classes for individual call descriptors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ic/ic-conventions.h"
8 #include "src/interface-descriptors.h" 7 #include "src/interface-descriptors.h"
9 8
10 namespace v8 { 9 namespace v8 {
11 namespace internal { 10 namespace internal {
12 11
13 void CallInterfaceDescriptor::Initialize( 12 void CallInterfaceDescriptorData::Initialize(
14 int register_parameter_count, Register* registers, 13 int register_parameter_count, Register* registers,
15 Representation* register_param_representations, 14 Representation* register_param_representations,
16 PlatformInterfaceDescriptor* platform_descriptor) { 15 PlatformInterfaceDescriptor* platform_descriptor) {
17 platform_specific_descriptor_ = platform_descriptor; 16 platform_specific_descriptor_ = platform_descriptor;
18 register_param_count_ = register_parameter_count; 17 register_param_count_ = register_parameter_count;
19 18
20 // An interface descriptor must have a context register. 19 // An interface descriptor must have a context register.
21 DCHECK(register_parameter_count > 0 && registers[0].is(ContextRegister())); 20 DCHECK(register_parameter_count > 0 &&
21 registers[0].is(CallInterfaceDescriptor::ContextRegister()));
22 22
23 // InterfaceDescriptor owns a copy of the registers array. 23 // InterfaceDescriptor owns a copy of the registers array.
24 register_params_.Reset(NewArray<Register>(register_parameter_count)); 24 register_params_.Reset(NewArray<Register>(register_parameter_count));
25 for (int i = 0; i < register_parameter_count; i++) { 25 for (int i = 0; i < register_parameter_count; i++) {
26 register_params_[i] = registers[i]; 26 register_params_[i] = registers[i];
27 } 27 }
28 28
29 // If a representations array is specified, then the descriptor owns that as 29 // If a representations array is specified, then the descriptor owns that as
30 // well. 30 // well.
31 if (register_param_representations != NULL) { 31 if (register_param_representations != NULL) {
32 register_param_representations_.Reset( 32 register_param_representations_.Reset(
33 NewArray<Representation>(register_parameter_count)); 33 NewArray<Representation>(register_parameter_count));
34 for (int i = 0; i < register_parameter_count; i++) { 34 for (int i = 0; i < register_parameter_count; i++) {
35 // If there is a context register, the representation must be tagged. 35 // If there is a context register, the representation must be tagged.
36 DCHECK( 36 DCHECK(
37 i != 0 || 37 i != 0 ||
38 register_param_representations[i].Equals(Representation::Tagged())); 38 register_param_representations[i].Equals(Representation::Tagged()));
39 register_param_representations_[i] = register_param_representations[i]; 39 register_param_representations_[i] = register_param_representations[i];
40 } 40 }
41 } 41 }
42 } 42 }
43 43
44 44
45 void CallDescriptors::InitializeForIsolateAllPlatforms(Isolate* isolate) { 45 void LoadDescriptor::Initialize(Isolate* isolate) {
46 { 46 Register registers[] = {ContextRegister(), ReceiverRegister(),
47 CallInterfaceDescriptor* descriptor = 47 NameRegister()};
48 isolate->call_descriptor(CallDescriptorKey::LoadICCall); 48 InitializeData(isolate, key(), arraysize(registers), registers, NULL);
49 Register registers[] = {CallInterfaceDescriptor::ContextRegister(), 49 }
50 LoadConvention::ReceiverRegister(), 50
51 LoadConvention::NameRegister()}; 51
52 descriptor->Initialize(arraysize(registers), registers, NULL); 52 void StoreDescriptor::Initialize(Isolate* isolate) {
53 } 53 Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
54 { 54 ValueRegister()};
55 CallInterfaceDescriptor* descriptor = 55 InitializeData(isolate, key(), arraysize(registers), registers, NULL);
56 isolate->call_descriptor(CallDescriptorKey::StoreICCall); 56 }
57 Register registers[] = {CallInterfaceDescriptor::ContextRegister(), 57
58 StoreConvention::ReceiverRegister(), 58
59 StoreConvention::NameRegister(), 59 void ElementTransitionAndStoreDescriptor::Initialize(Isolate* isolate) {
60 StoreConvention::ValueRegister()}; 60 Register registers[] = {ContextRegister(), ValueRegister(), MapRegister(),
61 descriptor->Initialize(arraysize(registers), registers, NULL); 61 NameRegister(), ReceiverRegister()};
62 } 62 InitializeData(isolate, key(), arraysize(registers), registers, NULL);
63 { 63 }
64 CallInterfaceDescriptor* descriptor = isolate->call_descriptor( 64
65 CallDescriptorKey::ElementTransitionAndStoreCall); 65
66 Register registers[] = { 66 void InstanceofDescriptor::Initialize(Isolate* isolate) {
67 CallInterfaceDescriptor::ContextRegister(), 67 Register registers[] = {ContextRegister(), left(), right()};
68 StoreConvention::ValueRegister(), StoreConvention::MapRegister(), 68 InitializeData(isolate, key(), arraysize(registers), registers, NULL);
69 StoreConvention::NameRegister(), StoreConvention::ReceiverRegister()}; 69 }
70 descriptor->Initialize(arraysize(registers), registers, NULL); 70
71 } 71
72 { 72 void VectorLoadICDescriptor::Initialize(Isolate* isolate) {
73 CallInterfaceDescriptor* descriptor = 73 Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
74 isolate->call_descriptor(CallDescriptorKey::InstanceofCall); 74 SlotRegister(), VectorRegister()};
75 Register registers[] = {CallInterfaceDescriptor::ContextRegister(), 75 InitializeData(isolate, key(), arraysize(registers), registers, NULL);
76 InstanceofConvention::left(), 76 }
77 InstanceofConvention::right()}; 77
78 descriptor->Initialize(arraysize(registers), registers, NULL); 78
79 } 79 void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
80 { 80 // Mechanically initialize all descriptors. The DCHECK makes sure that the
81 CallInterfaceDescriptor* descriptor = 81 // Initialize() method did what it is supposed to do.
82 isolate->call_descriptor(CallDescriptorKey::VectorLoadICCall); 82
83 Register registers[] = {CallInterfaceDescriptor::ContextRegister(), 83 #define INITIALIZE_DESCRIPTOR(D) \
84 FullVectorLoadConvention::ReceiverRegister(), 84 D##Descriptor::Initialize(isolate); \
85 FullVectorLoadConvention::NameRegister(), 85 DCHECK(D##Descriptor(isolate).IsInitialized());
86 FullVectorLoadConvention::SlotRegister(), 86
87 FullVectorLoadConvention::VectorRegister()}; 87 INTERFACE_DESCRIPTOR_LIST(INITIALIZE_DESCRIPTOR)
88 descriptor->Initialize(arraysize(registers), registers, NULL); 88 #undef INITIALIZE_DESCRIPTOR
89 }
90 } 89 }
91 } 90 }
92 } // namespace v8::internal 91 } // namespace v8::internal
OLDNEW
« src/interface-descriptors.h ('K') | « src/interface-descriptors.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698