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

Side by Side Diff: src/builtins.cc

Issue 1767663002: Revert of Reland "[api] Don't go to javascript to construct API functions" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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.h ('k') | src/execution.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.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 4135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4146 if (length() == 0) return; 4146 if (length() == 0) return;
4147 v->VisitPointers(lowest_address(), highest_address() + 1); 4147 v->VisitPointers(lowest_address(), highest_address() + 1);
4148 } 4148 }
4149 4149
4150 private: 4150 private:
4151 DISALLOW_COPY_AND_ASSIGN(RelocatableArguments); 4151 DISALLOW_COPY_AND_ASSIGN(RelocatableArguments);
4152 }; 4152 };
4153 4153
4154 } // namespace 4154 } // namespace
4155 4155
4156 MaybeHandle<Object> Builtins::InvokeApiFunction(bool is_construct, 4156 MaybeHandle<Object> Builtins::InvokeApiFunction(Handle<HeapObject> function,
4157 Handle<HeapObject> function,
4158 Handle<Object> receiver, 4157 Handle<Object> receiver,
4159 int argc, 4158 int argc,
4160 Handle<Object> args[]) { 4159 Handle<Object> args[]) {
4161 // Construct BuiltinArguments object: function, arguments reversed, receiver. 4160 // Construct BuiltinArguments object: function, arguments reversed, receiver.
4162 const int kBufferSize = 32; 4161 const int kBufferSize = 32;
4163 Object* small_argv[kBufferSize]; 4162 Object* small_argv[kBufferSize];
4164 Object** argv; 4163 Object** argv;
4165 if (argc + 2 <= kBufferSize) { 4164 if (argc + 2 <= kBufferSize) {
4166 argv = small_argv; 4165 argv = small_argv;
4167 } else { 4166 } else {
4168 argv = new Object* [argc + 2]; 4167 argv = new Object* [argc + 2];
4169 } 4168 }
4170 argv[argc + 1] = *receiver; 4169 argv[argc + 1] = *receiver;
4171 for (int i = 0; i < argc; ++i) { 4170 for (int i = 0; i < argc; ++i) {
4172 argv[argc - i] = *args[i]; 4171 argv[argc - i] = *args[i];
4173 } 4172 }
4174 argv[0] = *function; 4173 argv[0] = *function;
4175 MaybeHandle<Object> result; 4174 MaybeHandle<Object> result;
4176 { 4175 {
4177 auto isolate = function->GetIsolate(); 4176 auto isolate = function->GetIsolate();
4178 RelocatableArguments arguments(isolate, argc + 2, &argv[argc + 1]); 4177 RelocatableArguments arguments(isolate, argc + 2, &argv[argc + 1]);
4179 result = is_construct ? HandleApiCallHelper<true>(isolate, arguments) 4178 result = HandleApiCallHelper<false>(isolate, arguments);
4180 : HandleApiCallHelper<false>(isolate, arguments);
4181 } 4179 }
4182 if (argv != small_argv) { 4180 if (argv != small_argv) {
4183 delete[] argv; 4181 delete[] argv;
4184 } 4182 }
4185 return result; 4183 return result;
4186 } 4184 }
4187 4185
4188 4186
4189 // Helper function to handle calls to non-function objects created through the 4187 // Helper function to handle calls to non-function objects created through the
4190 // API. The object can be called as either a constructor (using new) or just as 4188 // API. The object can be called as either a constructor (using new) or just as
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
4586 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 4584 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
4587 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 4585 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
4588 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 4586 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
4589 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 4587 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
4590 #undef DEFINE_BUILTIN_ACCESSOR_C 4588 #undef DEFINE_BUILTIN_ACCESSOR_C
4591 #undef DEFINE_BUILTIN_ACCESSOR_A 4589 #undef DEFINE_BUILTIN_ACCESSOR_A
4592 4590
4593 4591
4594 } // namespace internal 4592 } // namespace internal
4595 } // namespace v8 4593 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698