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

Side by Side Diff: src/builtins/builtins.cc

Issue 2803853005: Inline Array.prototype.forEach in TurboFan (Closed)
Patch Set: Disable new array builtins by default Created 3 years, 6 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
« no previous file with comments | « src/builtins/builtins.h ('k') | src/builtins/builtins-array-gen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/builtins/builtins.h" 5 #include "src/builtins/builtins.h"
6 #include "src/api.h" 6 #include "src/api.h"
7 #include "src/assembler-inl.h" 7 #include "src/assembler-inl.h"
8 #include "src/builtins/builtins-descriptors.h" 8 #include "src/builtins/builtins-descriptors.h"
9 #include "src/callable.h" 9 #include "src/callable.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
11 #include "src/macro-assembler.h" 11 #include "src/macro-assembler.h"
12 #include "src/objects-inl.h" 12 #include "src/objects-inl.h"
13 #include "src/visitors.h" 13 #include "src/visitors.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 // Forward declarations for C++ builtins. 18 // Forward declarations for C++ builtins.
19 #define FORWARD_DECLARE(Name) \ 19 #define FORWARD_DECLARE(Name) \
20 Object* Builtin_##Name(int argc, Object** args, Isolate* isolate); 20 Object* Builtin_##Name(int argc, Object** args, Isolate* isolate);
21 BUILTIN_LIST_C(FORWARD_DECLARE) 21 BUILTIN_LIST_C(FORWARD_DECLARE)
22 22
23 Builtins::Builtins() : initialized_(false) { 23 Builtins::Builtins() : initialized_(false) {
24 memset(builtins_, 0, sizeof(builtins_[0]) * builtin_count); 24 memset(builtins_, 0, sizeof(builtins_[0]) * builtin_count);
25 } 25 }
26 26
27 Builtins::~Builtins() {} 27 Builtins::~Builtins() {}
28 28
29 BailoutId Builtins::GetContinuationBailoutId(Name name) {
30 switch (name) {
31 #define BAILOUT_ID(NAME, ...) \
32 case k##NAME: \
33 return BailoutId(BailoutId::kFirstBuiltinContinuationId + name);
34 BUILTIN_LIST_TFJ(BAILOUT_ID);
35 BUILTIN_LIST_TFC(BAILOUT_ID);
36 #undef BAILOUT_ID
37 default:
38 UNREACHABLE();
39 }
40 }
41
42 Builtins::Name Builtins::GetBuiltinFromBailoutId(BailoutId id) {
43 switch (id.ToInt()) {
44 #define BAILOUT_ID(NAME, ...) \
45 case BailoutId::kFirstBuiltinContinuationId + k##NAME: \
46 return k##NAME;
47 BUILTIN_LIST_TFJ(BAILOUT_ID)
48 BUILTIN_LIST_TFC(BAILOUT_ID)
49 #undef BAILOUT_ID
50 default:
51 UNREACHABLE();
52 }
53 }
54
29 void Builtins::TearDown() { initialized_ = false; } 55 void Builtins::TearDown() { initialized_ = false; }
30 56
31 void Builtins::IterateBuiltins(RootVisitor* v) { 57 void Builtins::IterateBuiltins(RootVisitor* v) {
32 v->VisitRootPointers(Root::kBuiltins, &builtins_[0], 58 v->VisitRootPointers(Root::kBuiltins, &builtins_[0],
33 &builtins_[0] + builtin_count); 59 &builtins_[0] + builtin_count);
34 } 60 }
35 61
36 const char* Builtins::Lookup(byte* pc) { 62 const char* Builtins::Lookup(byte* pc) {
37 // may be called during initialization (disassembler!) 63 // may be called during initialization (disassembler!)
38 if (initialized_) { 64 if (initialized_) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 133 }
108 134
109 // static 135 // static
110 Callable Builtins::CallableFor(Isolate* isolate, Name name) { 136 Callable Builtins::CallableFor(Isolate* isolate, Name name) {
111 Handle<Code> code( 137 Handle<Code> code(
112 reinterpret_cast<Code**>(isolate->builtins()->builtin_address(name))); 138 reinterpret_cast<Code**>(isolate->builtins()->builtin_address(name)));
113 CallDescriptors::Key key; 139 CallDescriptors::Key key;
114 switch (name) { 140 switch (name) {
115 // This macro is deliberately crafted so as to emit very little code, 141 // This macro is deliberately crafted so as to emit very little code,
116 // in order to keep binary size of this function under control. 142 // in order to keep binary size of this function under control.
117 #define CASE(Name, ...) \ 143 #define CASE_OTHER(Name, ...) \
118 case k##Name: { \ 144 case k##Name: { \
119 key = Builtin_##Name##_InterfaceDescriptor::key(); \ 145 key = Builtin_##Name##_InterfaceDescriptor::key(); \
120 break; \ 146 break; \
121 } 147 }
122 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, CASE, CASE, 148 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, CASE_OTHER,
123 CASE, IGNORE_BUILTIN, IGNORE_BUILTIN) 149 CASE_OTHER, CASE_OTHER, IGNORE_BUILTIN, IGNORE_BUILTIN)
124 #undef CASE 150 #undef CASE_OTHER
125 case kConsoleAssert: { 151 case kConsoleAssert: {
126 return Callable(code, BuiltinDescriptor(isolate)); 152 return Callable(code, BuiltinDescriptor(isolate));
127 } 153 }
154 case kArrayForEach: {
155 Handle<Code> code = isolate->builtins()->ArrayForEach();
156 return Callable(code, BuiltinDescriptor(isolate));
157 }
158 case kArrayForEachLoopEagerDeoptContinuation: {
159 Handle<Code> code =
160 isolate->builtins()->ArrayForEachLoopEagerDeoptContinuation();
161 return Callable(code, BuiltinDescriptor(isolate));
162 }
163 case kArrayForEachLoopLazyDeoptContinuation: {
164 Handle<Code> code =
165 isolate->builtins()->ArrayForEachLoopLazyDeoptContinuation();
166 return Callable(code, BuiltinDescriptor(isolate));
167 }
128 default: 168 default:
129 UNREACHABLE(); 169 UNREACHABLE();
130 } 170 }
131 CallInterfaceDescriptor descriptor(isolate, key); 171 CallInterfaceDescriptor descriptor(isolate, key);
132 return Callable(code, descriptor); 172 return Callable(code, descriptor);
133 } 173 }
134 174
135 // static 175 // static
176 int Builtins::GetStackParameterCount(Isolate* isolate, Name name) {
177 switch (name) {
178 #define CASE(Name, Count, ...) \
179 case k##Name: { \
180 return Count; \
181 }
182 BUILTIN_LIST_TFJ(CASE)
183 #undef CASE
184 default:
185 UNREACHABLE();
186 return 0;
187 }
188 }
189
190 // static
136 const char* Builtins::name(int index) { 191 const char* Builtins::name(int index) {
137 switch (index) { 192 switch (index) {
138 #define CASE(Name, ...) \ 193 #define CASE(Name, ...) \
139 case k##Name: \ 194 case k##Name: \
140 return #Name; 195 return #Name;
141 BUILTIN_LIST_ALL(CASE) 196 BUILTIN_LIST_ALL(CASE)
142 #undef CASE 197 #undef CASE
143 default: 198 default:
144 UNREACHABLE(); 199 UNREACHABLE();
145 break; 200 break;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // TODO(jochen): Remove this. 295 // TODO(jochen): Remove this.
241 if (responsible_context.is_null()) { 296 if (responsible_context.is_null()) {
242 return true; 297 return true;
243 } 298 }
244 if (*responsible_context == target->context()) return true; 299 if (*responsible_context == target->context()) return true;
245 return isolate->MayAccess(responsible_context, target_global_proxy); 300 return isolate->MayAccess(responsible_context, target_global_proxy);
246 } 301 }
247 302
248 } // namespace internal 303 } // namespace internal
249 } // namespace v8 304 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins.h ('k') | src/builtins/builtins-array-gen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698