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

Side by Side Diff: src/runtime/runtime-function.cc

Issue 1467473002: Install ConstructNonConstructable as construct stub for non-constructables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years 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/runtime/runtime-classes.cc ('k') | src/runtime/runtime-internal.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 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return isolate->heap()->ToBoolean(f->shared()->is_concise_method()); 100 return isolate->heap()->ToBoolean(f->shared()->is_concise_method());
101 } 101 }
102 102
103 103
104 RUNTIME_FUNCTION(Runtime_FunctionRemovePrototype) { 104 RUNTIME_FUNCTION(Runtime_FunctionRemovePrototype) {
105 SealHandleScope shs(isolate); 105 SealHandleScope shs(isolate);
106 DCHECK(args.length() == 1); 106 DCHECK(args.length() == 1);
107 107
108 CONVERT_ARG_CHECKED(JSFunction, f, 0); 108 CONVERT_ARG_CHECKED(JSFunction, f, 0);
109 RUNTIME_ASSERT(f->RemovePrototype()); 109 RUNTIME_ASSERT(f->RemovePrototype());
110 f->shared()->set_construct_stub(
111 *isolate->builtins()->ConstructedNonConstructable());
110 112
111 return isolate->heap()->undefined_value(); 113 return isolate->heap()->undefined_value();
112 } 114 }
113 115
114 116
115 RUNTIME_FUNCTION(Runtime_FunctionGetScript) { 117 RUNTIME_FUNCTION(Runtime_FunctionGetScript) {
116 HandleScope scope(isolate); 118 HandleScope scope(isolate);
117 DCHECK(args.length() == 1); 119 DCHECK(args.length() == 1);
118 120
119 CONVERT_ARG_CHECKED(JSFunction, fun, 0); 121 CONVERT_ARG_CHECKED(JSFunction, fun, 0);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0); 390 CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0);
389 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, bindee, 1); 391 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, bindee, 1);
390 CONVERT_ARG_HANDLE_CHECKED(Object, this_object, 2); 392 CONVERT_ARG_HANDLE_CHECKED(Object, this_object, 2);
391 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3); 393 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3);
392 394
393 // TODO(lrn): Create bound function in C++ code from premade shared info. 395 // TODO(lrn): Create bound function in C++ code from premade shared info.
394 bound_function->shared()->set_bound(true); 396 bound_function->shared()->set_bound(true);
395 bound_function->shared()->set_optimized_code_map( 397 bound_function->shared()->set_optimized_code_map(
396 isolate->heap()->cleared_optimized_code_map()); 398 isolate->heap()->cleared_optimized_code_map());
397 bound_function->shared()->set_inferred_name(isolate->heap()->empty_string()); 399 bound_function->shared()->set_inferred_name(isolate->heap()->empty_string());
400 bound_function->shared()->set_construct_stub(
401 *isolate->builtins()->JSBuiltinsConstructStub());
398 // Get all arguments of calling function (Function.prototype.bind). 402 // Get all arguments of calling function (Function.prototype.bind).
399 int argc = 0; 403 int argc = 0;
400 base::SmartArrayPointer<Handle<Object>> arguments = 404 base::SmartArrayPointer<Handle<Object>> arguments =
401 Runtime::GetCallerArguments(isolate, 0, &argc); 405 Runtime::GetCallerArguments(isolate, 0, &argc);
402 // Don't count the this-arg. 406 // Don't count the this-arg.
403 if (argc > 0) { 407 if (argc > 0) {
404 RUNTIME_ASSERT(arguments[0].is_identical_to(this_object)); 408 RUNTIME_ASSERT(arguments[0].is_identical_to(this_object));
405 argc--; 409 argc--;
406 } else { 410 } else {
407 RUNTIME_ASSERT(this_object->IsUndefined()); 411 RUNTIME_ASSERT(this_object->IsUndefined());
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 635
632 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { 636 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) {
633 HandleScope scope(isolate); 637 HandleScope scope(isolate);
634 DCHECK(args.length() == 0); 638 DCHECK(args.length() == 0);
635 THROW_NEW_ERROR_RETURN_FAILURE(isolate, 639 THROW_NEW_ERROR_RETURN_FAILURE(isolate,
636 NewTypeError(MessageTemplate::kStrongArity)); 640 NewTypeError(MessageTemplate::kStrongArity));
637 } 641 }
638 642
639 } // namespace internal 643 } // namespace internal
640 } // namespace v8 644 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698