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

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 501323002: Replace our homegrown ARRAY_SIZE() with Chrome's arraysize(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph-inl.h" 7 #include "src/compiler/graph-inl.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-aux-data-inl.h" 10 #include "src/compiler/node-aux-data-inl.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 virtual Handle<Code> GenerateCode() V8_OVERRIDE { 42 virtual Handle<Code> GenerateCode() V8_OVERRIDE {
43 ExtraICState extra_state = LoadIC::ComputeExtraICState(contextual_mode_); 43 ExtraICState extra_state = LoadIC::ComputeExtraICState(contextual_mode_);
44 return LoadIC::initialize_stub(isolate(), extra_state); 44 return LoadIC::initialize_stub(isolate(), extra_state);
45 } 45 }
46 46
47 virtual void InitializeInterfaceDescriptor( 47 virtual void InitializeInterfaceDescriptor(
48 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { 48 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
49 Register registers[] = { InterfaceDescriptor::ContextRegister(), 49 Register registers[] = { InterfaceDescriptor::ContextRegister(),
50 LoadIC::ReceiverRegister(), 50 LoadIC::ReceiverRegister(),
51 LoadIC::NameRegister() }; 51 LoadIC::NameRegister() };
52 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); 52 descriptor->Initialize(MajorKey(), arraysize(registers), registers);
53 } 53 }
54 54
55 private: 55 private:
56 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } 56 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
57 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } 57 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
58 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } 58 virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
59 59
60 ContextualMode contextual_mode_; 60 ContextualMode contextual_mode_;
61 }; 61 };
62 62
63 63
64 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub 64 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
65 // which doesn't have an interface descriptor yet. It mimics a hydrogen code 65 // which doesn't have an interface descriptor yet. It mimics a hydrogen code
66 // stub for the underlying IC stub code. 66 // stub for the underlying IC stub code.
67 class KeyedLoadICStubShim : public HydrogenCodeStub { 67 class KeyedLoadICStubShim : public HydrogenCodeStub {
68 public: 68 public:
69 explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) { 69 explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) {
70 i::compiler::GetInterfaceDescriptor(isolate, this); 70 i::compiler::GetInterfaceDescriptor(isolate, this);
71 } 71 }
72 72
73 virtual Handle<Code> GenerateCode() V8_OVERRIDE { 73 virtual Handle<Code> GenerateCode() V8_OVERRIDE {
74 return isolate()->builtins()->KeyedLoadIC_Initialize(); 74 return isolate()->builtins()->KeyedLoadIC_Initialize();
75 } 75 }
76 76
77 virtual void InitializeInterfaceDescriptor( 77 virtual void InitializeInterfaceDescriptor(
78 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { 78 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
79 Register registers[] = { InterfaceDescriptor::ContextRegister(), 79 Register registers[] = { InterfaceDescriptor::ContextRegister(),
80 KeyedLoadIC::ReceiverRegister(), 80 KeyedLoadIC::ReceiverRegister(),
81 KeyedLoadIC::NameRegister() }; 81 KeyedLoadIC::NameRegister() };
82 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); 82 descriptor->Initialize(MajorKey(), arraysize(registers), registers);
83 } 83 }
84 84
85 private: 85 private:
86 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } 86 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
87 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } 87 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
88 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } 88 virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
89 }; 89 };
90 90
91 91
92 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub 92 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
93 // which doesn't have an interface descriptor yet. It mimics a hydrogen code 93 // which doesn't have an interface descriptor yet. It mimics a hydrogen code
94 // stub for the underlying IC stub code. 94 // stub for the underlying IC stub code.
95 class StoreICStubShim : public HydrogenCodeStub { 95 class StoreICStubShim : public HydrogenCodeStub {
96 public: 96 public:
97 StoreICStubShim(Isolate* isolate, StrictMode strict_mode) 97 StoreICStubShim(Isolate* isolate, StrictMode strict_mode)
98 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { 98 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) {
99 i::compiler::GetInterfaceDescriptor(isolate, this); 99 i::compiler::GetInterfaceDescriptor(isolate, this);
100 } 100 }
101 101
102 virtual Handle<Code> GenerateCode() V8_OVERRIDE { 102 virtual Handle<Code> GenerateCode() V8_OVERRIDE {
103 return StoreIC::initialize_stub(isolate(), strict_mode_); 103 return StoreIC::initialize_stub(isolate(), strict_mode_);
104 } 104 }
105 105
106 virtual void InitializeInterfaceDescriptor( 106 virtual void InitializeInterfaceDescriptor(
107 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { 107 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
108 Register registers[] = { InterfaceDescriptor::ContextRegister(), 108 Register registers[] = { InterfaceDescriptor::ContextRegister(),
109 StoreIC::ReceiverRegister(), 109 StoreIC::ReceiverRegister(),
110 StoreIC::NameRegister(), 110 StoreIC::NameRegister(),
111 StoreIC::ValueRegister() }; 111 StoreIC::ValueRegister() };
112 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); 112 descriptor->Initialize(MajorKey(), arraysize(registers), registers);
113 } 113 }
114 114
115 private: 115 private:
116 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } 116 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
117 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } 117 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
118 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } 118 virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
119 119
120 StrictMode strict_mode_; 120 StrictMode strict_mode_;
121 }; 121 };
122 122
(...skipping 13 matching lines...) Expand all
136 ? isolate()->builtins()->KeyedStoreIC_Initialize() 136 ? isolate()->builtins()->KeyedStoreIC_Initialize()
137 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 137 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
138 } 138 }
139 139
140 virtual void InitializeInterfaceDescriptor( 140 virtual void InitializeInterfaceDescriptor(
141 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { 141 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
142 Register registers[] = { InterfaceDescriptor::ContextRegister(), 142 Register registers[] = { InterfaceDescriptor::ContextRegister(),
143 KeyedStoreIC::ReceiverRegister(), 143 KeyedStoreIC::ReceiverRegister(),
144 KeyedStoreIC::NameRegister(), 144 KeyedStoreIC::NameRegister(),
145 KeyedStoreIC::ValueRegister() }; 145 KeyedStoreIC::ValueRegister() };
146 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); 146 descriptor->Initialize(MajorKey(), arraysize(registers), registers);
147 } 147 }
148 148
149 private: 149 private:
150 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } 150 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
151 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } 151 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
152 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } 152 virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
153 153
154 StrictMode strict_mode_; 154 StrictMode strict_mode_;
155 }; 155 };
156 156
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 540
541 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { 541 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) {
542 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); 542 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node);
543 int arity = OperatorProperties::GetValueInputCount(node->op()); 543 int arity = OperatorProperties::GetValueInputCount(node->op());
544 ReplaceWithRuntimeCall(node, function, arity); 544 ReplaceWithRuntimeCall(node, function, arity);
545 return node; 545 return node;
546 } 546 }
547 } 547 }
548 } 548 }
549 } // namespace v8::internal::compiler 549 } // namespace v8::internal::compiler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698