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

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

Issue 1510753005: Fix Function subclassing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adressing comments 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/objects-printer.cc ('k') | src/transitions-inl.h » ('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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Create a new JSFunction object with correct initial map. 70 // Create a new JSFunction object with correct initial map.
71 HandleScope handle_scope(isolate); 71 HandleScope handle_scope(isolate);
72 72
73 DCHECK(constructor->has_initial_map()); 73 DCHECK(constructor->has_initial_map());
74 Handle<Map> initial_map; 74 Handle<Map> initial_map;
75 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 75 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
76 isolate, initial_map, 76 isolate, initial_map,
77 JSFunction::GetDerivedMap(isolate, constructor, new_target)); 77 JSFunction::GetDerivedMap(isolate, constructor, new_target));
78 78
79 Handle<SharedFunctionInfo> shared_info(func->shared(), isolate); 79 Handle<SharedFunctionInfo> shared_info(func->shared(), isolate);
80 Handle<Map> map = Map::AsLanguageMode(
81 initial_map, shared_info->language_mode(), shared_info->kind());
82
80 Handle<Context> context(func->context(), isolate); 83 Handle<Context> context(func->context(), isolate);
81 Handle<JSFunction> result = 84 Handle<JSFunction> result =
82 isolate->factory()->NewFunctionFromSharedFunctionInfo( 85 isolate->factory()->NewFunctionFromSharedFunctionInfo(
83 initial_map, shared_info, context, NOT_TENURED); 86 map, shared_info, context, NOT_TENURED);
84 DCHECK_EQ(func->IsConstructor(), result->IsConstructor()); 87 DCHECK_EQ(func->IsConstructor(), result->IsConstructor());
85 return *result; 88 return *result;
86 } 89 }
87 90
88 91
89 RUNTIME_FUNCTION(Runtime_FunctionIsArrow) { 92 RUNTIME_FUNCTION(Runtime_FunctionIsArrow) {
90 SealHandleScope shs(isolate); 93 SealHandleScope shs(isolate);
91 DCHECK(args.length() == 1); 94 DCHECK(args.length() == 1);
92 CONVERT_ARG_CHECKED(JSFunction, f, 0); 95 CONVERT_ARG_CHECKED(JSFunction, f, 0);
93 return isolate->heap()->ToBoolean(f->shared()->is_arrow()); 96 return isolate->heap()->ToBoolean(f->shared()->is_arrow());
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 615
613 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { 616 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) {
614 HandleScope scope(isolate); 617 HandleScope scope(isolate);
615 DCHECK(args.length() == 0); 618 DCHECK(args.length() == 0);
616 THROW_NEW_ERROR_RETURN_FAILURE(isolate, 619 THROW_NEW_ERROR_RETURN_FAILURE(isolate,
617 NewTypeError(MessageTemplate::kStrongArity)); 620 NewTypeError(MessageTemplate::kStrongArity));
618 } 621 }
619 622
620 } // namespace internal 623 } // namespace internal
621 } // namespace v8 624 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698