ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- // new.target
+ // Evaluate new.target and super constructor.
VisitForStackValue(args->at(0));
-
- // .this_function
VisitForStackValue(args->at(1));
- __ CallRuntime(Runtime::kGetPrototype, 1);
- __ Push(result_register());
// Load original constructor into r4.
__ ldr(r4, MemOperand(sp, 1 * kPointerSize));
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- // new.target
+ // Evaluate new.target and super constructor.
VisitForStackValue(args->at(0));
-
- // .this_function
VisitForStackValue(args->at(1));
- __ CallRuntime(Runtime::kGetPrototype, 1);
- __ Push(result_register());
// Load original constructor into x4.
__ Peek(x4, 1 * kPointerSize);
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- // new.target
+ // Evaluate new.target and super constructor.
VisitForStackValue(args->at(0));
-
- // .this_function
VisitForStackValue(args->at(1));
- __ CallRuntime(Runtime::kGetPrototype, 1);
- __ push(result_register());
// Load original constructor into ecx.
__ mov(ecx, Operand(esp, 1 * kPointerSize));
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- // new.target
+ // Evaluate new.target and super constructor.
VisitForStackValue(args->at(0));
-
- // .this_function
VisitForStackValue(args->at(1));
- __ CallRuntime(Runtime::kGetPrototype, 1);
- __ Push(result_register());
// Load original constructor into t0.
__ lw(t0, MemOperand(sp, 1 * kPointerSize));
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- // new.target
+ // Evaluate new.target and super constructor.
VisitForStackValue(args->at(0));
-
- // .this_function
VisitForStackValue(args->at(1));
- __ CallRuntime(Runtime::kGetPrototype, 1);
- __ Push(result_register());
// Load original constructor into a4.
__ ld(a4, MemOperand(sp, 1 * kPointerSize));
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- // new.target
+ // Evaluate new.target and super constructor.
VisitForStackValue(args->at(0));
-
- // .this_function
VisitForStackValue(args->at(1));
- __ CallRuntime(Runtime::kGetPrototype, 1);
- __ mr(r4, result_register());
- __ Push(r4);
// Load original constructor into r7.
__ LoadP(r7, MemOperand(sp, 1 * kPointerSize));
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- // new.target
+ // Evaluate new.target and super constructor.
VisitForStackValue(args->at(0));
-
- // .this_function
VisitForStackValue(args->at(1));
- __ CallRuntime(Runtime::kGetPrototype, 1);
- __ Push(result_register());
// Load original constructor into rcx.
__ movp(rcx, Operand(rsp, 1 * kPointerSize));
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- // new.target
+ // Evaluate new.target and super constructor.
VisitForStackValue(args->at(0));
-
- // .this_function
VisitForStackValue(args->at(1));
- __ CallRuntime(Runtime::kGetPrototype, 1);
- __ push(result_register());
// Load original constructor into ecx.
__ mov(ecx, Operand(esp, 1 * kPointerSize));
body = new (zone()) ZoneList<Statement*>(call_super ? 2 : 1, zone());
AddAssertIsConstruct(body, pos);
if (call_super) {
- // %_DefaultConstructorCallSuper(new.target, .this_function)
+ // %_DefaultConstructorCallSuper(new.target, %GetPrototype(<this-fun>))
ZoneList<Expression*>* args =
new (zone()) ZoneList<Expression*>(2, zone());
VariableProxy* new_target_proxy = scope_->NewUnresolved(
VariableProxy* this_function_proxy = scope_->NewUnresolved(
factory(), ast_value_factory()->this_function_string(),
Variable::NORMAL, pos);
- args->Add(this_function_proxy, zone());
+ ZoneList<Expression*>* tmp =
+ new (zone()) ZoneList<Expression*>(1, zone());
+ tmp->Add(this_function_proxy, zone());
+ Expression* get_prototype =
+ factory()->NewCallRuntime(Runtime::kGetPrototype, tmp, pos);
+ args->Add(get_prototype, zone());
CallRuntime* call = factory()->NewCallRuntime(
Runtime::kInlineDefaultConstructorCallSuper, args, pos);
body->Add(factory()->NewReturnStatement(call, pos), zone());
HandleScope scope(isolate);
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, original_constructor, 0);
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, actual_constructor, 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, super_constructor, 1);
JavaScriptFrameIterator it(isolate);
- // Prepare the callee to the super call. The super constructor is stored as
- // the prototype of the constructor we are currently executing.
- Handle<Object> super_constructor;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, super_constructor,
- Runtime::GetPrototype(isolate, actual_constructor));
-
// Determine the actual arguments passed to the function.
int argument_count = 0;
base::SmartArrayPointer<Handle<Object>> arguments =
}
-MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate,
- Handle<Object> obj) {
+RUNTIME_FUNCTION(Runtime_GetPrototype) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
// We don't expect access checks to be needed on JSProxy objects.
DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject());
PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER);
if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() &&
!isolate->MayAccess(
Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)))) {
- return isolate->factory()->null_value();
+ return isolate->heap()->null_value();
}
iter.AdvanceIgnoringProxies();
if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
- return PrototypeIterator::GetCurrent(iter);
+ return *PrototypeIterator::GetCurrent(iter);
}
} while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN));
- return PrototypeIterator::GetCurrent(iter);
-}
-
-
-RUNTIME_FUNCTION(Runtime_GetPrototype) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
- Runtime::GetPrototype(isolate, obj));
- return *result;
+ return *PrototypeIterator::GetCurrent(iter);
}
Isolate* isolate, Handle<Object> receiver_obj, Handle<Object> key_obj,
LanguageMode language_mode);
- // TODO(mstarzinger): Remove this once %DefaultConstructorCallSuper is gone.
- MUST_USE_RESULT static MaybeHandle<Object> GetPrototype(
- Isolate* isolate, Handle<Object> object);
-
enum TypedArrayId {
// arrayIds below should be synchronized with typedarray.js natives.
ARRAY_ID_UINT8 = 1,