[runtime] [proxy] removing JSFunctionProxy and related code.
BUG=v8:1543 LOG=N Review URL: https://codereview.chromium.org/1496503002 Cr-Commit-Position: refs/heads/master@{#32616}
This commit is contained in:
parent
eb9407c6f5
commit
747f455b07
@ -7093,7 +7093,7 @@ class Internals {
|
||||
static const int kNodeIsPartiallyDependentShift = 4;
|
||||
static const int kNodeIsActiveShift = 4;
|
||||
|
||||
static const int kJSObjectType = 0xb8;
|
||||
static const int kJSObjectType = 0xb7;
|
||||
static const int kFirstNonstringType = 0x80;
|
||||
static const int kOddballType = 0x83;
|
||||
static const int kForeignType = 0x87;
|
||||
|
@ -1682,14 +1682,11 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
|
||||
__ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE);
|
||||
__ Jump(masm->isolate()->builtins()->CallFunction(mode),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
__ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE));
|
||||
__ cmp(r5, Operand(JS_PROXY_TYPE));
|
||||
__ b(ne, &non_function);
|
||||
|
||||
// 1. Call to function proxy.
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies.
|
||||
__ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kCallTrapOffset));
|
||||
__ AssertNotSmi(r1);
|
||||
__ b(&non_smi);
|
||||
// 1. Call to Proxy.
|
||||
// TODO(neis): Implement [[Call]] on proxies.
|
||||
|
||||
// 2. Call to something else, which might have a [[Call]] internal method (if
|
||||
// not we raise an exception).
|
||||
@ -1741,13 +1738,12 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
|
||||
void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- r0 : the number of arguments (not including the receiver)
|
||||
// -- r1 : the constructor to call (checked to be a JSFunctionProxy)
|
||||
// -- r1 : the constructor to call (checked to be a JSProxy)
|
||||
// -- r3 : the new target (either the same as the constructor or
|
||||
// the JSFunction on which new was invoked initially)
|
||||
// -----------------------------------
|
||||
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
||||
__ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kConstructTrapOffset));
|
||||
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
@ -1769,7 +1765,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
__ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE);
|
||||
__ Jump(masm->isolate()->builtins()->ConstructFunction(),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
__ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE));
|
||||
__ cmp(r5, Operand(JS_PROXY_TYPE));
|
||||
__ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
|
||||
eq);
|
||||
|
||||
|
@ -1674,14 +1674,11 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
|
||||
__ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE);
|
||||
__ Jump(masm->isolate()->builtins()->CallFunction(mode),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
__ Cmp(x5, JS_FUNCTION_PROXY_TYPE);
|
||||
__ Cmp(x5, JS_PROXY_TYPE);
|
||||
__ B(ne, &non_function);
|
||||
|
||||
// 1. Call to function proxy.
|
||||
// 1. Call to proxy.
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies.
|
||||
__ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kCallTrapOffset));
|
||||
__ AssertNotSmi(x1);
|
||||
__ B(&non_smi);
|
||||
|
||||
// 2. Call to something else, which might have a [[Call]] internal method (if
|
||||
// not we raise an exception).
|
||||
@ -1733,13 +1730,12 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
|
||||
void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- x0 : the number of arguments (not including the receiver)
|
||||
// -- x1 : the constructor to call (checked to be a JSFunctionProxy)
|
||||
// -- x1 : the constructor to call (checked to be a JSProxy)
|
||||
// -- x3 : the new target (either the same as the constructor or
|
||||
// the JSFunction on which new was invoked initially)
|
||||
// -----------------------------------
|
||||
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
||||
__ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset));
|
||||
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
@ -1761,7 +1757,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
__ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE);
|
||||
__ Jump(masm->isolate()->builtins()->ConstructFunction(),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
__ Cmp(x5, JS_FUNCTION_PROXY_TYPE);
|
||||
__ Cmp(x5, JS_PROXY_TYPE);
|
||||
__ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
|
||||
eq);
|
||||
|
||||
|
@ -724,10 +724,9 @@ void JSGenericLowering::LowerJSForInPrepare(Node* node) {
|
||||
jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag),
|
||||
effect, if_false0);
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
Node* check1 = graph()->NewNode(
|
||||
machine()->Uint32LessThanOrEqual(), object_instance_type,
|
||||
jsgraph()->Uint32Constant(LAST_JS_PROXY_TYPE));
|
||||
Node* check1 =
|
||||
graph()->NewNode(machine()->Word32Equal(), object_instance_type,
|
||||
jsgraph()->Uint32Constant(JS_PROXY_TYPE));
|
||||
Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse),
|
||||
check1, if_false0);
|
||||
|
||||
|
@ -2137,12 +2137,10 @@ Reduction JSTypedLowering::ReduceJSForInPrepare(Node* node) {
|
||||
simplified()->LoadField(AccessBuilder::ForMapInstanceType()),
|
||||
receiver_map, effect, if_false0);
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
cache_type_false0 = graph()->NewNode(
|
||||
common()->Select(kMachAnyTagged, BranchHint::kFalse),
|
||||
graph()->NewNode(machine()->Uint32LessThanOrEqual(),
|
||||
receiver_instance_type,
|
||||
jsgraph()->Uint32Constant(LAST_JS_PROXY_TYPE)),
|
||||
graph()->NewNode(machine()->Word32Equal(), receiver_instance_type,
|
||||
jsgraph()->Uint32Constant(JS_PROXY_TYPE)),
|
||||
jsgraph()->ZeroConstant(), // Zero indicagtes proxy.
|
||||
jsgraph()->OneConstant()); // One means slow check.
|
||||
|
||||
|
@ -5498,8 +5498,8 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
||||
__ SmiTst(r0);
|
||||
DeoptimizeIf(eq, instr, Deoptimizer::kSmi);
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r0, r1, r1, LAST_JS_PROXY_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r0, r1, r1, JS_PROXY_TYPE);
|
||||
DeoptimizeIf(le, instr, Deoptimizer::kWrongInstanceType);
|
||||
|
||||
Label use_cache, call_runtime;
|
||||
|
@ -2770,8 +2770,8 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
||||
|
||||
DeoptimizeIfSmi(object, instr, Deoptimizer::kSmi);
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(object, x1, x1, LAST_JS_PROXY_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(object, x1, x1, JS_PROXY_TYPE);
|
||||
DeoptimizeIf(le, instr, Deoptimizer::kNotAJavaScriptObject);
|
||||
|
||||
Label use_cache, call_runtime;
|
||||
|
@ -12314,10 +12314,7 @@ void HOptimizedGraphBuilder::GenerateIsJSProxy(CallRuntime* call) {
|
||||
HValue* instance_type =
|
||||
Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapInstanceType());
|
||||
if_proxy.If<HCompareNumericAndBranch>(
|
||||
instance_type, Add<HConstant>(FIRST_JS_PROXY_TYPE), Token::GTE);
|
||||
if_proxy.And();
|
||||
if_proxy.If<HCompareNumericAndBranch>(
|
||||
instance_type, Add<HConstant>(LAST_JS_PROXY_TYPE), Token::LTE);
|
||||
instance_type, Add<HConstant>(JS_PROXY_TYPE), Token::EQ);
|
||||
|
||||
if_proxy.CaptureContinuation(&continuation);
|
||||
return ast_context()->ReturnContinuation(&continuation, call->id());
|
||||
|
@ -5373,8 +5373,8 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
||||
__ test(eax, Immediate(kSmiTagMask));
|
||||
DeoptimizeIf(zero, instr, Deoptimizer::kSmi);
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(eax, JS_PROXY_TYPE, ecx);
|
||||
DeoptimizeIf(below_equal, instr, Deoptimizer::kWrongInstanceType);
|
||||
|
||||
Label use_cache, call_runtime;
|
||||
|
@ -5542,10 +5542,10 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
||||
__ And(at, object, kSmiTagMask);
|
||||
DeoptimizeIf(eq, instr, Deoptimizer::kSmi, at, Operand(zero_reg));
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ GetObjectType(object, a1, a1);
|
||||
DeoptimizeIf(le, instr, Deoptimizer::kNotAJavaScriptObject, a1,
|
||||
Operand(LAST_JS_PROXY_TYPE));
|
||||
Operand(JS_PROXY_TYPE));
|
||||
|
||||
Label use_cache, call_runtime;
|
||||
DCHECK(object.is(a0));
|
||||
|
@ -5732,10 +5732,10 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
||||
__ And(at, object, kSmiTagMask);
|
||||
DeoptimizeIf(eq, instr, Deoptimizer::kSmi, at, Operand(zero_reg));
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ GetObjectType(object, a1, a1);
|
||||
DeoptimizeIf(le, instr, Deoptimizer::kNotAJavaScriptObject, a1,
|
||||
Operand(LAST_JS_PROXY_TYPE));
|
||||
Operand(JS_PROXY_TYPE));
|
||||
|
||||
Label use_cache, call_runtime;
|
||||
DCHECK(object.is(a0));
|
||||
|
@ -5777,8 +5777,8 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
||||
__ TestIfSmi(r3, r0);
|
||||
DeoptimizeIf(eq, instr, Deoptimizer::kSmi, cr0);
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r3, r4, r4, LAST_JS_PROXY_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r3, r4, r4, JS_PROXY_TYPE);
|
||||
DeoptimizeIf(le, instr, Deoptimizer::kWrongInstanceType);
|
||||
|
||||
Label use_cache, call_runtime;
|
||||
|
@ -5571,8 +5571,8 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
||||
Condition cc = masm()->CheckSmi(rax);
|
||||
DeoptimizeIf(cc, instr, Deoptimizer::kSmi);
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(rax, LAST_JS_PROXY_TYPE, rcx);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(rax, JS_PROXY_TYPE, rcx);
|
||||
DeoptimizeIf(below_equal, instr, Deoptimizer::kWrongInstanceType);
|
||||
|
||||
Label use_cache, call_runtime;
|
||||
|
@ -5933,8 +5933,8 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
||||
__ test(eax, Immediate(kSmiTagMask));
|
||||
DeoptimizeIf(zero, instr, Deoptimizer::kSmi);
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(eax, JS_PROXY_TYPE, ecx);
|
||||
DeoptimizeIf(below_equal, instr, Deoptimizer::kWrongInstanceType);
|
||||
|
||||
Label use_cache, call_runtime;
|
||||
|
@ -1951,30 +1951,6 @@ Handle<JSProxy> Factory::NewJSProxy(Handle<JSReceiver> target,
|
||||
}
|
||||
|
||||
|
||||
Handle<JSProxy> Factory::NewJSFunctionProxy(Handle<JSReceiver> target,
|
||||
Handle<JSReceiver> handler,
|
||||
Handle<JSReceiver> call_trap,
|
||||
Handle<Object> construct_trap,
|
||||
Handle<Object> prototype) {
|
||||
// Allocate map.
|
||||
// TODO(rossberg): Once we optimize proxies, think about a scheme to share
|
||||
// maps. Will probably depend on the identity of the handler object, too.
|
||||
Handle<Map> map = NewMap(JS_FUNCTION_PROXY_TYPE, JSFunctionProxy::kSize);
|
||||
Map::SetPrototype(map, prototype);
|
||||
map->set_is_callable();
|
||||
map->set_is_constructor(construct_trap->IsCallable());
|
||||
|
||||
// Allocate the proxy object.
|
||||
Handle<JSFunctionProxy> result = New<JSFunctionProxy>(map, NEW_SPACE);
|
||||
result->set_target(*target);
|
||||
result->set_handler(*handler);
|
||||
result->set_hash(*undefined_value(), SKIP_WRITE_BARRIER);
|
||||
result->set_call_trap(*call_trap);
|
||||
result->set_construct_trap(*construct_trap);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Handle<JSGlobalProxy> Factory::NewUninitializedJSGlobalProxy() {
|
||||
// Create an empty shell of a JSGlobalProxy that needs to be reinitialized
|
||||
// via ReinitializeJSGlobalProxy later.
|
||||
|
@ -481,13 +481,6 @@ class Factory final {
|
||||
Handle<JSProxy> NewJSProxy(Handle<JSReceiver> target,
|
||||
Handle<JSReceiver> handler);
|
||||
|
||||
// Allocates a Harmony function proxy.
|
||||
Handle<JSProxy> NewJSFunctionProxy(Handle<JSReceiver> target,
|
||||
Handle<JSReceiver> handler,
|
||||
Handle<JSReceiver> call_trap,
|
||||
Handle<Object> construct_trap,
|
||||
Handle<Object> prototype);
|
||||
|
||||
// Reinitialize an JSGlobalProxy based on a constructor. The object
|
||||
// must have the same size as objects allocated using the
|
||||
// constructor. The object is reinitialized and behaves as an
|
||||
|
@ -1046,9 +1046,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
// Check for proxies.
|
||||
Label call_runtime;
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r0, r1, r1, LAST_JS_PROXY_TYPE);
|
||||
__ b(le, &call_runtime);
|
||||
__ CompareObjectType(r0, r1, r1, JS_PROXY_TYPE);
|
||||
__ b(eq, &call_runtime);
|
||||
|
||||
// Check cache validity in generated code. This is a fast case for
|
||||
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
||||
@ -1111,8 +1110,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
__ mov(r1, Operand(Smi::FromInt(1))); // Smi indicates slow check
|
||||
__ ldr(r2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r2, r3, r3, LAST_JS_PROXY_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r2, r3, r3, JS_PROXY_TYPE);
|
||||
__ b(gt, &non_proxy);
|
||||
__ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy
|
||||
__ bind(&non_proxy);
|
||||
@ -3256,14 +3255,9 @@ void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) {
|
||||
&if_false, &fall_through);
|
||||
|
||||
__ JumpIfSmi(r0, if_false);
|
||||
Register map = r1;
|
||||
Register type_reg = r2;
|
||||
__ ldr(map, FieldMemOperand(r0, HeapObject::kMapOffset));
|
||||
__ ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
|
||||
__ sub(type_reg, type_reg, Operand(FIRST_JS_PROXY_TYPE));
|
||||
__ cmp(type_reg, Operand(LAST_JS_PROXY_TYPE - FIRST_JS_PROXY_TYPE));
|
||||
__ CompareObjectType(r0, r1, r1, JS_PROXY_TYPE);
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
Split(ls, if_true, if_false, fall_through);
|
||||
Split(eq, if_true, if_false, fall_through);
|
||||
|
||||
context()->Plug(if_true, if_false);
|
||||
}
|
||||
|
@ -1046,8 +1046,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
// Check for proxies.
|
||||
Label call_runtime;
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ JumpIfObjectType(x0, x10, x11, LAST_JS_PROXY_TYPE, &call_runtime, le);
|
||||
__ JumpIfObjectType(x0, x10, x11, JS_PROXY_TYPE, &call_runtime, eq);
|
||||
|
||||
// Check cache validity in generated code. This is a fast case for
|
||||
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
||||
@ -1105,11 +1104,10 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
__ Mov(x1, Smi::FromInt(1)); // Smi indicates slow check.
|
||||
__ Peek(x10, 0); // Get enumerated object.
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
// TODO(all): similar check was done already. Can we avoid it here?
|
||||
__ CompareObjectType(x10, x11, x12, LAST_JS_PROXY_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(x10, x11, x12, JS_PROXY_TYPE);
|
||||
DCHECK(Smi::FromInt(0) == 0);
|
||||
__ CzeroX(x1, le); // Zero indicates proxy.
|
||||
__ CzeroX(x1, eq); // Zero indicates proxy.
|
||||
__ Ldr(x2, FieldMemOperand(x0, FixedArray::kLengthOffset));
|
||||
// Smi and array, fixed array length (as smi) and initial index.
|
||||
__ Push(x1, x0, x2, xzr);
|
||||
@ -2965,14 +2963,9 @@ void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) {
|
||||
&if_false, &fall_through);
|
||||
|
||||
__ JumpIfSmi(x0, if_false);
|
||||
Register map = x10;
|
||||
Register type_reg = x11;
|
||||
__ Ldr(map, FieldMemOperand(x0, HeapObject::kMapOffset));
|
||||
__ Ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
|
||||
__ Sub(type_reg, type_reg, Operand(FIRST_JS_PROXY_TYPE));
|
||||
__ Cmp(type_reg, Operand(LAST_JS_PROXY_TYPE - FIRST_JS_PROXY_TYPE));
|
||||
__ CompareObjectType(x0, x10, x11, JS_PROXY_TYPE);
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
Split(ls, if_true, if_false, fall_through);
|
||||
Split(eq, if_true, if_false, fall_through);
|
||||
|
||||
context()->Plug(if_true, if_false);
|
||||
}
|
||||
|
@ -980,9 +980,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
// Check for proxies.
|
||||
Label call_runtime, use_cache, fixed_array;
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx);
|
||||
__ j(below_equal, &call_runtime);
|
||||
__ CmpObjectType(eax, JS_PROXY_TYPE, ecx);
|
||||
__ j(equal, &call_runtime);
|
||||
|
||||
// Check cache validity in generated code. This is a fast case for
|
||||
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
||||
@ -1038,8 +1037,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
__ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check
|
||||
__ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(ecx, JS_PROXY_TYPE, ecx);
|
||||
__ j(above, &non_proxy);
|
||||
__ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy
|
||||
__ bind(&non_proxy);
|
||||
@ -3137,13 +3136,9 @@ void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) {
|
||||
&if_false, &fall_through);
|
||||
|
||||
__ JumpIfSmi(eax, if_false);
|
||||
Register map = ebx;
|
||||
__ mov(map, FieldOperand(eax, HeapObject::kMapOffset));
|
||||
__ CmpInstanceType(map, FIRST_JS_PROXY_TYPE);
|
||||
__ j(less, if_false);
|
||||
__ CmpInstanceType(map, LAST_JS_PROXY_TYPE);
|
||||
__ CmpObjectType(eax, JS_PROXY_TYPE, ebx);
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
Split(less_equal, if_true, if_false, fall_through);
|
||||
Split(equal, if_true, if_false, fall_through);
|
||||
|
||||
context()->Plug(if_true, if_false);
|
||||
}
|
||||
|
@ -1040,9 +1040,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
// Check for proxies.
|
||||
Label call_runtime;
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ GetObjectType(a0, a1, a1);
|
||||
__ Branch(&call_runtime, le, a1, Operand(LAST_JS_PROXY_TYPE));
|
||||
__ Branch(&call_runtime, eq, a1, Operand(JS_PROXY_TYPE));
|
||||
|
||||
// Check cache validity in generated code. This is a fast case for
|
||||
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
||||
@ -1102,9 +1101,9 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
__ li(a1, Operand(Smi::FromInt(1))); // Smi indicates slow check
|
||||
__ lw(a2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ GetObjectType(a2, a3, a3);
|
||||
__ Branch(&non_proxy, gt, a3, Operand(LAST_JS_PROXY_TYPE));
|
||||
__ Branch(&non_proxy, gt, a3, Operand(JS_PROXY_TYPE));
|
||||
__ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy
|
||||
__ bind(&non_proxy);
|
||||
__ Push(a1, v0); // Smi and array
|
||||
@ -3250,13 +3249,9 @@ void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) {
|
||||
&if_false, &fall_through);
|
||||
|
||||
__ JumpIfSmi(v0, if_false);
|
||||
Register map = a1;
|
||||
Register type_reg = a2;
|
||||
__ GetObjectType(v0, map, type_reg);
|
||||
__ Subu(type_reg, type_reg, Operand(FIRST_JS_PROXY_TYPE));
|
||||
__ GetObjectType(v0, a1, a1);
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
Split(ls, type_reg, Operand(LAST_JS_PROXY_TYPE - FIRST_JS_PROXY_TYPE),
|
||||
if_true, if_false, fall_through);
|
||||
Split(eq, a1, Operand(JS_PROXY_TYPE), if_true, if_false, fall_through);
|
||||
|
||||
context()->Plug(if_true, if_false);
|
||||
}
|
||||
|
@ -1040,9 +1040,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
// Check for proxies.
|
||||
Label call_runtime;
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ GetObjectType(a0, a1, a1);
|
||||
__ Branch(&call_runtime, le, a1, Operand(LAST_JS_PROXY_TYPE));
|
||||
__ Branch(&call_runtime, eq, a1, Operand(JS_PROXY_TYPE));
|
||||
|
||||
// Check cache validity in generated code. This is a fast case for
|
||||
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
||||
@ -1102,9 +1101,9 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
__ li(a1, Operand(Smi::FromInt(1))); // Smi indicates slow check
|
||||
__ ld(a2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ GetObjectType(a2, a3, a3);
|
||||
__ Branch(&non_proxy, gt, a3, Operand(LAST_JS_PROXY_TYPE));
|
||||
__ Branch(&non_proxy, gt, a3, Operand(JS_PROXY_TYPE));
|
||||
__ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy
|
||||
__ bind(&non_proxy);
|
||||
__ Push(a1, v0); // Smi and array
|
||||
@ -3254,13 +3253,9 @@ void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) {
|
||||
&if_false, &fall_through);
|
||||
|
||||
__ JumpIfSmi(v0, if_false);
|
||||
Register map = a1;
|
||||
Register type_reg = a2;
|
||||
__ GetObjectType(v0, map, type_reg);
|
||||
__ Subu(type_reg, type_reg, Operand(FIRST_JS_PROXY_TYPE));
|
||||
__ GetObjectType(v0, a1, a1);
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
Split(ls, type_reg, Operand(LAST_JS_PROXY_TYPE - FIRST_JS_PROXY_TYPE),
|
||||
if_true, if_false, fall_through);
|
||||
Split(eq, a1, Operand(JS_PROXY_TYPE), if_true, if_false, fall_through);
|
||||
|
||||
context()->Plug(if_true, if_false);
|
||||
}
|
||||
|
@ -1003,9 +1003,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
// Check for proxies.
|
||||
Label call_runtime;
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r3, r4, r4, LAST_JS_PROXY_TYPE);
|
||||
__ ble(&call_runtime);
|
||||
__ CompareObjectType(r3, r4, r4, JS_PROXY_TYPE);
|
||||
__ beq(&call_runtime);
|
||||
|
||||
// Check cache validity in generated code. This is a fast case for
|
||||
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
||||
@ -1070,8 +1069,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
__ LoadSmiLiteral(r4, Smi::FromInt(1)); // Smi indicates slow check
|
||||
__ LoadP(r5, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r5, r6, r6, LAST_JS_PROXY_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CompareObjectType(r5, r6, r6, JS_PROXY_TYPE);
|
||||
__ bgt(&non_proxy);
|
||||
__ LoadSmiLiteral(r4, Smi::FromInt(0)); // Zero indicates proxy
|
||||
__ bind(&non_proxy);
|
||||
@ -3253,14 +3252,9 @@ void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) {
|
||||
&if_false, &fall_through);
|
||||
|
||||
__ JumpIfSmi(r3, if_false);
|
||||
Register map = r4;
|
||||
Register type_reg = r5;
|
||||
__ LoadP(map, FieldMemOperand(r3, HeapObject::kMapOffset));
|
||||
__ lbz(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
|
||||
__ subi(type_reg, type_reg, Operand(FIRST_JS_PROXY_TYPE));
|
||||
__ cmpli(type_reg, Operand(LAST_JS_PROXY_TYPE - FIRST_JS_PROXY_TYPE));
|
||||
__ CompareObjectType(r3, r4, r4, JS_PROXY_TYPE);
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
Split(le, if_true, if_false, fall_through);
|
||||
Split(eq, if_true, if_false, fall_through);
|
||||
|
||||
context()->Plug(if_true, if_false);
|
||||
}
|
||||
|
@ -994,9 +994,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
// Check for proxies.
|
||||
Label call_runtime;
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(rax, LAST_JS_PROXY_TYPE, rcx);
|
||||
__ j(below_equal, &call_runtime);
|
||||
__ CmpObjectType(rax, JS_PROXY_TYPE, rcx);
|
||||
__ j(equal, &call_runtime);
|
||||
|
||||
// Check cache validity in generated code. This is a fast case for
|
||||
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
||||
@ -1059,8 +1058,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
TypeFeedbackVector::MegamorphicSentinel(isolate()));
|
||||
__ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check
|
||||
__ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(rcx, LAST_JS_PROXY_TYPE, rcx);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(rcx, JS_PROXY_TYPE, rcx);
|
||||
__ j(above, &non_proxy);
|
||||
__ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy
|
||||
__ bind(&non_proxy);
|
||||
@ -3119,14 +3118,11 @@ void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) {
|
||||
context()->PrepareTest(&materialize_true, &materialize_false, &if_true,
|
||||
&if_false, &fall_through);
|
||||
|
||||
|
||||
__ JumpIfSmi(rax, if_false);
|
||||
Register map = rbx;
|
||||
__ movp(map, FieldOperand(rax, HeapObject::kMapOffset));
|
||||
__ CmpInstanceType(map, FIRST_JS_PROXY_TYPE);
|
||||
__ j(less, if_false);
|
||||
__ CmpInstanceType(map, LAST_JS_PROXY_TYPE);
|
||||
__ CmpObjectType(rax, JS_PROXY_TYPE, rbx);
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
Split(less_equal, if_true, if_false, fall_through);
|
||||
Split(equal, if_true, if_false, fall_through);
|
||||
|
||||
context()->Plug(if_true, if_false);
|
||||
}
|
||||
|
@ -983,9 +983,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
// Check for proxies.
|
||||
Label call_runtime, use_cache, fixed_array;
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx);
|
||||
__ j(below_equal, &call_runtime);
|
||||
__ CmpObjectType(eax, JS_PROXY_TYPE, ecx);
|
||||
__ j(equal, &call_runtime);
|
||||
|
||||
// Check cache validity in generated code. This is a fast case for
|
||||
// the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
||||
@ -1041,8 +1040,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
||||
|
||||
__ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check
|
||||
__ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
__ CmpObjectType(ecx, JS_PROXY_TYPE, ecx);
|
||||
__ j(above, &non_proxy);
|
||||
__ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy
|
||||
__ bind(&non_proxy);
|
||||
@ -3139,14 +3138,11 @@ void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) {
|
||||
context()->PrepareTest(&materialize_true, &materialize_false, &if_true,
|
||||
&if_false, &fall_through);
|
||||
|
||||
|
||||
__ JumpIfSmi(eax, if_false);
|
||||
Register map = ebx;
|
||||
__ mov(map, FieldOperand(eax, HeapObject::kMapOffset));
|
||||
__ CmpInstanceType(map, FIRST_JS_PROXY_TYPE);
|
||||
__ j(less, if_false);
|
||||
__ CmpInstanceType(map, LAST_JS_PROXY_TYPE);
|
||||
__ CmpObjectType(eax, JS_PROXY_TYPE, ebx);
|
||||
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
|
||||
Split(less_equal, if_true, if_false, fall_through);
|
||||
Split(equal, if_true, if_false, fall_through);
|
||||
|
||||
context()->Plug(if_true, if_false);
|
||||
}
|
||||
|
@ -93,7 +93,6 @@ StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId(
|
||||
return kVisitSharedFunctionInfo;
|
||||
|
||||
case JS_PROXY_TYPE:
|
||||
case JS_FUNCTION_PROXY_TYPE:
|
||||
return GetVisitorIdForSize(kVisitStruct, kVisitStructGeneric,
|
||||
instance_size, has_unboxed_fields);
|
||||
|
||||
|
@ -1539,14 +1539,11 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
|
||||
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
|
||||
__ j(equal, masm->isolate()->builtins()->CallFunction(mode),
|
||||
RelocInfo::CODE_TARGET);
|
||||
__ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
|
||||
__ CmpInstanceType(ecx, JS_PROXY_TYPE);
|
||||
__ j(not_equal, &non_function);
|
||||
|
||||
// 1. Call to function proxy.
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies.
|
||||
__ mov(edi, FieldOperand(edi, JSFunctionProxy::kCallTrapOffset));
|
||||
__ AssertNotSmi(edi);
|
||||
__ jmp(&non_smi);
|
||||
// 1. Call to Proxy.
|
||||
// TODO(neis): Implement [[Call]] on proxies.
|
||||
|
||||
// 2. Call to something else, which might have a [[Call]] internal method (if
|
||||
// not we raise an exception).
|
||||
@ -1600,11 +1597,10 @@ void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
|
||||
// -- eax : the number of arguments (not including the receiver)
|
||||
// -- edx : the new target (either the same as the constructor or
|
||||
// the JSFunction on which new was invoked initially)
|
||||
// -- edi : the constructor to call (checked to be a JSFunctionProxy)
|
||||
// -- edi : the constructor to call (checked to be a JSProxy)
|
||||
// -----------------------------------
|
||||
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
||||
__ mov(edi, FieldOperand(edi, JSFunctionProxy::kConstructTrapOffset));
|
||||
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
@ -1626,7 +1622,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
|
||||
__ j(equal, masm->isolate()->builtins()->ConstructFunction(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
__ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
|
||||
__ CmpInstanceType(ecx, JS_PROXY_TYPE);
|
||||
__ j(equal, masm->isolate()->builtins()->ConstructProxy(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
|
||||
|
@ -22,26 +22,6 @@ utils.Import(function(from) {
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function ProxyCreateFunction(handler, callTrap, constructTrap) {
|
||||
if (!IS_SPEC_OBJECT(handler))
|
||||
throw MakeTypeError(kProxyHandlerNonObject, "createFunction")
|
||||
if (!IS_CALLABLE(callTrap))
|
||||
throw MakeTypeError(kProxyTrapFunctionExpected, "call")
|
||||
if (IS_UNDEFINED(constructTrap)) {
|
||||
constructTrap = DerivedConstructTrap(callTrap)
|
||||
} else if (IS_CALLABLE(constructTrap)) {
|
||||
// Make sure the trap receives 'undefined' as this.
|
||||
var construct = constructTrap
|
||||
constructTrap = function() {
|
||||
return %Apply(construct, UNDEFINED, arguments, 0, %_ArgumentsLength());
|
||||
}
|
||||
} else {
|
||||
throw MakeTypeError(kProxyTrapFunctionExpected, "construct")
|
||||
}
|
||||
return %CreateJSFunctionProxy(
|
||||
{}, handler, callTrap, constructTrap, GlobalFunction.prototype)
|
||||
}
|
||||
|
||||
function ProxyCreateRevocable(target, handler) {
|
||||
var p = new GlobalProxy(target, handler);
|
||||
return {proxy: p, revoke: () => %RevokeProxy(p)};
|
||||
@ -149,8 +129,7 @@ function ProxyEnumerate(trap, handler, target) {
|
||||
|
||||
//Set up non-enumerable properties of the Proxy object.
|
||||
utils.InstallFunctions(GlobalProxy, DONT_ENUM, [
|
||||
"revocable", ProxyCreateRevocable,
|
||||
"createFunction", ProxyCreateFunction
|
||||
"revocable", ProxyCreateRevocable
|
||||
]);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -1542,10 +1542,6 @@ function NativeCodeFunctionSourceString(func) {
|
||||
}
|
||||
|
||||
function FunctionSourceString(func) {
|
||||
while (%IsJSFunctionProxy(func)) {
|
||||
func = %GetCallTrap(func);
|
||||
}
|
||||
|
||||
if (!IS_FUNCTION(func)) {
|
||||
throw MakeTypeError(kNotGeneric, 'Function.prototype.toString');
|
||||
}
|
||||
|
@ -1692,13 +1692,10 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
|
||||
__ GetObjectType(a1, t1, t2);
|
||||
__ Jump(masm->isolate()->builtins()->CallFunction(mode),
|
||||
RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
|
||||
__ Branch(&non_function, ne, t2, Operand(JS_FUNCTION_PROXY_TYPE));
|
||||
__ Branch(&non_function, ne, t2, Operand(JS_PROXY_TYPE));
|
||||
|
||||
// 1. Call to function proxy.
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies.
|
||||
__ lw(a1, FieldMemOperand(a1, JSFunctionProxy::kCallTrapOffset));
|
||||
__ AssertNotSmi(a1);
|
||||
__ Branch(&non_smi);
|
||||
// 1. Call Proxy.
|
||||
// TODO(neis): implement call on Proxy
|
||||
|
||||
// 2. Call to something else, which might have a [[Call]] internal method (if
|
||||
// not we raise an exception).
|
||||
@ -1753,13 +1750,12 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
|
||||
void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- a0 : the number of arguments (not including the receiver)
|
||||
// -- a1 : the constructor to call (checked to be a JSFunctionProxy)
|
||||
// -- a1 : the constructor to call (checked to be a JSProxy)
|
||||
// -- a3 : the new target (either the same as the constructor or
|
||||
// the JSFunction on which new was invoked initially)
|
||||
// -----------------------------------
|
||||
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
||||
__ lw(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset));
|
||||
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
@ -1783,7 +1779,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
__ Jump(masm->isolate()->builtins()->ConstructFunction(),
|
||||
RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
|
||||
__ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
|
||||
eq, t2, Operand(JS_FUNCTION_PROXY_TYPE));
|
||||
eq, t2, Operand(JS_PROXY_TYPE));
|
||||
|
||||
// Check if target has a [[Construct]] internal method.
|
||||
__ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset));
|
||||
|
@ -1684,13 +1684,10 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
|
||||
__ GetObjectType(a1, t1, t2);
|
||||
__ Jump(masm->isolate()->builtins()->CallFunction(mode),
|
||||
RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
|
||||
__ Branch(&non_function, ne, t2, Operand(JS_FUNCTION_PROXY_TYPE));
|
||||
__ Branch(&non_function, ne, t2, Operand(JS_PROXY_TYPE));
|
||||
|
||||
// 1. Call to function proxy.
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies.
|
||||
__ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kCallTrapOffset));
|
||||
__ AssertNotSmi(a1);
|
||||
__ Branch(&non_smi);
|
||||
// TODO(neis): Implement [[Call]] on proxies.
|
||||
|
||||
// 2. Call to something else, which might have a [[Call]] internal method (if
|
||||
// not we raise an exception).
|
||||
@ -1744,13 +1741,12 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
|
||||
void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- a0 : the number of arguments (not including the receiver)
|
||||
// -- a1 : the constructor to call (checked to be a JSFunctionProxy)
|
||||
// -- a1 : the constructor to call (checked to be a JSProxy)
|
||||
// -- a3 : the new target (either the same as the constructor or
|
||||
// the JSFunction on which new was invoked initially)
|
||||
// -----------------------------------
|
||||
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
||||
__ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset));
|
||||
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
@ -1774,7 +1770,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
__ Jump(masm->isolate()->builtins()->ConstructFunction(),
|
||||
RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
|
||||
__ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
|
||||
eq, t2, Operand(JS_FUNCTION_PROXY_TYPE));
|
||||
eq, t2, Operand(JS_PROXY_TYPE));
|
||||
|
||||
// Check if target has a [[Construct]] internal method.
|
||||
__ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset));
|
||||
|
@ -481,8 +481,6 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3) {
|
||||
return Op::template apply<Oddball::BodyDescriptor>(p1, p2, p3);
|
||||
case JS_PROXY_TYPE:
|
||||
return Op::template apply<JSProxy::BodyDescriptor>(p1, p2, p3);
|
||||
case JS_FUNCTION_PROXY_TYPE:
|
||||
return Op::template apply<JSFunctionProxy::BodyDescriptor>(p1, p2, p3);
|
||||
case FOREIGN_TYPE:
|
||||
return Op::template apply<Foreign::BodyDescriptor>(p1, p2, p3);
|
||||
case MAP_TYPE:
|
||||
|
@ -164,9 +164,6 @@ void HeapObject::HeapObjectVerify() {
|
||||
case JS_PROXY_TYPE:
|
||||
JSProxy::cast(this)->JSProxyVerify();
|
||||
break;
|
||||
case JS_FUNCTION_PROXY_TYPE:
|
||||
JSFunctionProxy::cast(this)->JSFunctionProxyVerify();
|
||||
break;
|
||||
case FOREIGN_TYPE:
|
||||
Foreign::cast(this)->ForeignVerify();
|
||||
break;
|
||||
@ -820,15 +817,6 @@ void JSProxy::JSProxyVerify() {
|
||||
}
|
||||
|
||||
|
||||
void JSFunctionProxy::JSFunctionProxyVerify() {
|
||||
CHECK(IsJSFunctionProxy());
|
||||
JSProxyVerify();
|
||||
VerifyPointer(call_trap());
|
||||
VerifyPointer(construct_trap());
|
||||
CHECK(map()->is_callable());
|
||||
}
|
||||
|
||||
|
||||
void JSArrayBuffer::JSArrayBufferVerify() {
|
||||
CHECK(IsJSArrayBuffer());
|
||||
JSObjectVerify();
|
||||
|
@ -702,7 +702,6 @@ bool Object::IsJSProxy() const {
|
||||
}
|
||||
|
||||
|
||||
TYPE_CHECKER(JSFunctionProxy, JS_FUNCTION_PROXY_TYPE)
|
||||
TYPE_CHECKER(JSSet, JS_SET_TYPE)
|
||||
TYPE_CHECKER(JSMap, JS_MAP_TYPE)
|
||||
TYPE_CHECKER(JSSetIterator, JS_SET_ITERATOR_TYPE)
|
||||
@ -3222,7 +3221,6 @@ CAST_ACCESSOR(JSArrayBufferView)
|
||||
CAST_ACCESSOR(JSDataView)
|
||||
CAST_ACCESSOR(JSDate)
|
||||
CAST_ACCESSOR(JSFunction)
|
||||
CAST_ACCESSOR(JSFunctionProxy)
|
||||
CAST_ACCESSOR(JSGeneratorObject)
|
||||
CAST_ACCESSOR(JSGlobalObject)
|
||||
CAST_ACCESSOR(JSGlobalProxy)
|
||||
@ -4822,10 +4820,7 @@ bool Map::IsJSObjectMap() {
|
||||
bool Map::IsJSArrayMap() { return instance_type() == JS_ARRAY_TYPE; }
|
||||
bool Map::IsJSFunctionMap() { return instance_type() == JS_FUNCTION_TYPE; }
|
||||
bool Map::IsStringMap() { return instance_type() < FIRST_NONSTRING_TYPE; }
|
||||
bool Map::IsJSProxyMap() {
|
||||
InstanceType type = instance_type();
|
||||
return FIRST_JS_PROXY_TYPE <= type && type <= LAST_JS_PROXY_TYPE;
|
||||
}
|
||||
bool Map::IsJSProxyMap() { return instance_type() == JS_PROXY_TYPE; }
|
||||
bool Map::IsJSGlobalProxyMap() {
|
||||
return instance_type() == JS_GLOBAL_PROXY_TYPE;
|
||||
}
|
||||
@ -6342,10 +6337,6 @@ ACCESSORS(JSProxy, hash, Object, kHashOffset)
|
||||
|
||||
bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); }
|
||||
|
||||
ACCESSORS(JSFunctionProxy, call_trap, JSReceiver, kCallTrapOffset)
|
||||
ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset)
|
||||
|
||||
|
||||
ACCESSORS(JSCollection, table, Object, kTableOffset)
|
||||
|
||||
|
||||
|
@ -131,9 +131,6 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
|
||||
case JS_PROXY_TYPE:
|
||||
JSProxy::cast(this)->JSProxyPrint(os);
|
||||
break;
|
||||
case JS_FUNCTION_PROXY_TYPE:
|
||||
JSFunctionProxy::cast(this)->JSFunctionProxyPrint(os);
|
||||
break;
|
||||
case JS_SET_TYPE:
|
||||
JSSet::cast(this)->JSSetPrint(os);
|
||||
break;
|
||||
@ -751,19 +748,6 @@ void JSProxy::JSProxyPrint(std::ostream& os) { // NOLINT
|
||||
}
|
||||
|
||||
|
||||
void JSFunctionProxy::JSFunctionProxyPrint(std::ostream& os) { // NOLINT
|
||||
HeapObject::PrintHeader(os, "JSFunctionProxy");
|
||||
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
|
||||
os << " - handler = ";
|
||||
handler()->Print(os);
|
||||
os << "\n - call_trap = ";
|
||||
call_trap()->Print(os);
|
||||
os << "\n - construct_trap = ";
|
||||
construct_trap()->Print(os);
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
|
||||
void JSSet::JSSetPrint(std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(os, this, "JSSet");
|
||||
os << " - table = " << Brief(table());
|
||||
|
@ -2102,9 +2102,6 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
|
||||
case JS_PROXY_TYPE:
|
||||
os << "<JSProxy>";
|
||||
break;
|
||||
case JS_FUNCTION_PROXY_TYPE:
|
||||
os << "<JSFunctionProxy>";
|
||||
break;
|
||||
case FOREIGN_TYPE:
|
||||
os << "<Foreign>";
|
||||
break;
|
||||
@ -2288,7 +2285,7 @@ void Simd128Value::CopyBits(void* destination) const {
|
||||
|
||||
|
||||
String* JSReceiver::class_name() {
|
||||
if (IsJSFunction() || IsJSFunctionProxy()) {
|
||||
if (IsJSFunction()) {
|
||||
return GetHeap()->Function_string();
|
||||
}
|
||||
Object* maybe_constructor = map()->GetConstructor();
|
||||
@ -4798,12 +4795,8 @@ MaybeHandle<Context> JSProxy::GetFunctionRealm(Handle<JSProxy> proxy) {
|
||||
THROW_NEW_ERROR(proxy->GetIsolate(),
|
||||
NewTypeError(MessageTemplate::kProxyRevoked), Context);
|
||||
}
|
||||
|
||||
// TODO(verwaest): Get rid of JSFunctionProxies.
|
||||
Object* target = proxy->IsJSFunctionProxy()
|
||||
? JSFunctionProxy::cast(*proxy)->construct_trap()
|
||||
: proxy->target();
|
||||
return JSReceiver::GetFunctionRealm(handle(JSReceiver::cast(target)));
|
||||
Handle<JSReceiver> target(JSReceiver::cast(proxy->target()));
|
||||
return JSReceiver::GetFunctionRealm(target);
|
||||
}
|
||||
|
||||
|
||||
@ -12522,7 +12515,6 @@ bool CanSubclassHaveInobjectProperties(InstanceType instance_type) {
|
||||
case JS_FUNCTION_TYPE:
|
||||
return true;
|
||||
|
||||
case JS_FUNCTION_PROXY_TYPE:
|
||||
case JS_PROXY_TYPE:
|
||||
case JS_GLOBAL_PROXY_TYPE:
|
||||
case JS_GLOBAL_OBJECT_TYPE:
|
||||
|
@ -69,7 +69,6 @@
|
||||
// - JSDate
|
||||
// - JSMessageObject
|
||||
// - JSProxy
|
||||
// - JSFunctionProxy
|
||||
// - FixedArrayBase
|
||||
// - ByteArray
|
||||
// - BytecodeArray
|
||||
@ -439,7 +438,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
|
||||
V(JS_REGEXP_TYPE) \
|
||||
\
|
||||
V(JS_FUNCTION_TYPE) \
|
||||
V(JS_FUNCTION_PROXY_TYPE) \
|
||||
V(DEBUG_INFO_TYPE) \
|
||||
V(BREAK_POINT_INFO_TYPE)
|
||||
|
||||
@ -711,9 +709,8 @@ enum InstanceType {
|
||||
// objects in the JS sense. The first and the last type in this range are
|
||||
// the two forms of function. This organization enables using the same
|
||||
// compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range.
|
||||
JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE
|
||||
JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE
|
||||
JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE
|
||||
JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE
|
||||
JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE
|
||||
JS_MESSAGE_OBJECT_TYPE,
|
||||
JS_DATE_TYPE,
|
||||
JS_OBJECT_TYPE,
|
||||
@ -757,16 +754,13 @@ enum InstanceType {
|
||||
// are not continuous in this enum! The enum ranges instead reflect the
|
||||
// external class names, where proxies are treated as either ordinary objects,
|
||||
// or functions.
|
||||
FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE,
|
||||
FIRST_JS_RECEIVER_TYPE = JS_PROXY_TYPE,
|
||||
LAST_JS_RECEIVER_TYPE = LAST_TYPE,
|
||||
// Boundaries for testing the types represented as JSObject
|
||||
FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE,
|
||||
LAST_JS_OBJECT_TYPE = LAST_TYPE,
|
||||
// Boundaries for testing the types represented as JSProxy
|
||||
FIRST_JS_PROXY_TYPE = JS_FUNCTION_PROXY_TYPE,
|
||||
LAST_JS_PROXY_TYPE = JS_PROXY_TYPE,
|
||||
//
|
||||
FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_PROXY_TYPE,
|
||||
FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_VALUE_TYPE,
|
||||
LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE,
|
||||
// Note that the types for which typeof is "function" are not continuous.
|
||||
// Define this so that we can put assertions on discrete checks.
|
||||
@ -975,7 +969,6 @@ template <class C> inline bool Is(Object* obj);
|
||||
V(JSTypedArray) \
|
||||
V(JSDataView) \
|
||||
V(JSProxy) \
|
||||
V(JSFunctionProxy) \
|
||||
V(JSSet) \
|
||||
V(JSMap) \
|
||||
V(JSSetIterator) \
|
||||
@ -9597,32 +9590,6 @@ class JSProxy: public JSReceiver {
|
||||
};
|
||||
|
||||
|
||||
class JSFunctionProxy: public JSProxy {
|
||||
public:
|
||||
// [call_trap]: The call trap.
|
||||
DECL_ACCESSORS(call_trap, JSReceiver)
|
||||
|
||||
// [construct_trap]: The construct trap.
|
||||
DECL_ACCESSORS(construct_trap, Object)
|
||||
|
||||
DECLARE_CAST(JSFunctionProxy)
|
||||
|
||||
// Dispatched behavior.
|
||||
DECLARE_PRINTER(JSFunctionProxy)
|
||||
DECLARE_VERIFIER(JSFunctionProxy)
|
||||
|
||||
// Layout description.
|
||||
static const int kCallTrapOffset = JSProxy::kSize;
|
||||
static const int kConstructTrapOffset = kCallTrapOffset + kPointerSize;
|
||||
static const int kSize = kConstructTrapOffset + kPointerSize;
|
||||
|
||||
typedef FixedBodyDescriptor<kTargetOffset, kSize, kSize> BodyDescriptor;
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy);
|
||||
};
|
||||
|
||||
|
||||
class JSCollection : public JSObject {
|
||||
public:
|
||||
// [table]: the backing hash table
|
||||
|
@ -1695,14 +1695,11 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
|
||||
__ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE);
|
||||
__ Jump(masm->isolate()->builtins()->CallFunction(mode),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
__ cmpi(r8, Operand(JS_FUNCTION_PROXY_TYPE));
|
||||
__ cmpi(r8, Operand(JS_PROXY_TYPE));
|
||||
__ bne(&non_function);
|
||||
|
||||
// 1. Call to function proxy.
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies.
|
||||
__ LoadP(r4, FieldMemOperand(r4, JSFunctionProxy::kCallTrapOffset));
|
||||
__ AssertNotSmi(r4);
|
||||
__ b(&non_smi);
|
||||
// TODO(neis): Implement [[Call]] on proxies.
|
||||
|
||||
// 2. Call to something else, which might have a [[Call]] internal method (if
|
||||
// not we raise an exception).
|
||||
@ -1756,13 +1753,12 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
|
||||
void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- r3 : the number of arguments (not including the receiver)
|
||||
// -- r4 : the constructor to call (checked to be a JSFunctionProxy)
|
||||
// -- r4 : the constructor to call (checked to be a JSProxy)
|
||||
// -- r6 : the new target (either the same as the constructor or
|
||||
// the JSFunction on which new was invoked initially)
|
||||
// -----------------------------------
|
||||
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
||||
__ LoadP(r4, FieldMemOperand(r4, JSFunctionProxy::kConstructTrapOffset));
|
||||
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
@ -1784,7 +1780,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
__ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE);
|
||||
__ Jump(masm->isolate()->builtins()->ConstructFunction(),
|
||||
RelocInfo::CODE_TARGET, eq);
|
||||
__ cmpi(r8, Operand(JS_FUNCTION_PROXY_TYPE));
|
||||
__ cmpi(r8, Operand(JS_PROXY_TYPE));
|
||||
__ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
|
||||
eq);
|
||||
|
||||
|
@ -175,9 +175,8 @@ RUNTIME_FUNCTION(Runtime_InterpreterForInPrepare) {
|
||||
cache_array = Handle<FixedArray>::cast(cache_type);
|
||||
cache_length = cache_array->length();
|
||||
|
||||
STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
if (receiver_map->instance_type() <= LAST_JS_PROXY_TYPE) {
|
||||
DCHECK_GE(receiver_map->instance_type(), LAST_JS_PROXY_TYPE);
|
||||
STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
|
||||
if (receiver_map->instance_type() == JS_PROXY_TYPE) {
|
||||
// Zero indicates proxy
|
||||
cache_type = Handle<Object>(Smi::FromInt(0), isolate);
|
||||
} else {
|
||||
|
@ -11,19 +11,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_CreateJSFunctionProxy) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 5);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, call_trap, 2);
|
||||
RUNTIME_ASSERT(call_trap->IsJSFunction() || call_trap->IsJSFunctionProxy());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, construct_trap, 3);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 4);
|
||||
if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value();
|
||||
return *isolate->factory()->NewJSFunctionProxy(target, handler, call_trap,
|
||||
construct_trap, prototype);
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_IsJSProxy) {
|
||||
@ -34,14 +21,6 @@ RUNTIME_FUNCTION(Runtime_IsJSProxy) {
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_IsJSFunctionProxy) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
|
||||
return isolate->heap()->ToBoolean(obj->IsJSFunctionProxy());
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_GetHandler) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
@ -50,22 +29,6 @@ RUNTIME_FUNCTION(Runtime_GetHandler) {
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_GetCallTrap) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
CONVERT_ARG_CHECKED(JSFunctionProxy, proxy, 0);
|
||||
return proxy->call_trap();
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_GetConstructTrap) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
CONVERT_ARG_CHECKED(JSFunctionProxy, proxy, 0);
|
||||
return proxy->construct_trap();
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_RevokeProxy) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
@ -74,6 +37,5 @@ RUNTIME_FUNCTION(Runtime_RevokeProxy) {
|
||||
return isolate->heap()->undefined_value();
|
||||
}
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -542,15 +542,10 @@ namespace internal {
|
||||
F(BitwiseXor_Strong, 2, 1)
|
||||
|
||||
#define FOR_EACH_INTRINSIC_PROXY(F) \
|
||||
F(CreateJSFunctionProxy, 5, 1) \
|
||||
F(IsJSProxy, 1, 1) \
|
||||
F(IsJSFunctionProxy, 1, 1) \
|
||||
F(GetHandler, 1, 1) \
|
||||
F(GetCallTrap, 1, 1) \
|
||||
F(GetConstructTrap, 1, 1) \
|
||||
F(RevokeProxy, 1, 1)
|
||||
|
||||
|
||||
#define FOR_EACH_INTRINSIC_REGEXP(F) \
|
||||
F(StringReplaceGlobalRegExpWithString, 4, 1) \
|
||||
F(StringSplit, 3, 1) \
|
||||
|
@ -253,7 +253,6 @@ TypeImpl<Config>::BitsetType::Lub(i::Map* map) {
|
||||
case JS_REGEXP_TYPE:
|
||||
return kOtherObject; // TODO(rossberg): there should be a RegExp type.
|
||||
case JS_PROXY_TYPE:
|
||||
case JS_FUNCTION_PROXY_TYPE:
|
||||
return kProxy;
|
||||
case MAP_TYPE:
|
||||
// When compiling stub templates, the meta map is used as a place holder
|
||||
|
@ -1742,14 +1742,11 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
|
||||
__ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
|
||||
__ j(equal, masm->isolate()->builtins()->CallFunction(mode),
|
||||
RelocInfo::CODE_TARGET);
|
||||
__ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
|
||||
__ CmpInstanceType(rcx, JS_PROXY_TYPE);
|
||||
__ j(not_equal, &non_function);
|
||||
|
||||
// 1. Call to function proxy.
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies.
|
||||
__ movp(rdi, FieldOperand(rdi, JSFunctionProxy::kCallTrapOffset));
|
||||
__ AssertNotSmi(rdi);
|
||||
__ jmp(&non_smi);
|
||||
// TODO(neis): Implement [[Call]] on proxies.
|
||||
|
||||
// 2. Call to something else, which might have a [[Call]] internal method (if
|
||||
// not we raise an exception).
|
||||
@ -1804,11 +1801,10 @@ void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
|
||||
// -- rax : the number of arguments (not including the receiver)
|
||||
// -- rdx : the new target (either the same as the constructor or
|
||||
// the JSFunction on which new was invoked initially)
|
||||
// -- rdi : the constructor to call (checked to be a JSFunctionProxy)
|
||||
// -- rdi : the constructor to call (checked to be a JSProxy)
|
||||
// -----------------------------------
|
||||
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
||||
__ movp(rdi, FieldOperand(rdi, JSFunctionProxy::kConstructTrapOffset));
|
||||
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
@ -1831,7 +1827,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
__ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
|
||||
__ j(equal, masm->isolate()->builtins()->ConstructFunction(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
__ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
|
||||
__ CmpInstanceType(rcx, JS_PROXY_TYPE);
|
||||
__ j(equal, masm->isolate()->builtins()->ConstructProxy(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
|
||||
|
@ -1552,14 +1552,11 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
|
||||
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
|
||||
__ j(equal, masm->isolate()->builtins()->CallFunction(mode),
|
||||
RelocInfo::CODE_TARGET);
|
||||
__ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
|
||||
__ CmpInstanceType(ecx, JS_PROXY_TYPE);
|
||||
__ j(not_equal, &non_function);
|
||||
|
||||
// 1. Call to function proxy.
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies.
|
||||
__ mov(edi, FieldOperand(edi, JSFunctionProxy::kCallTrapOffset));
|
||||
__ AssertNotSmi(edi);
|
||||
__ jmp(&non_smi);
|
||||
// TODO(neis): Implement [[Call]] on proxies.
|
||||
|
||||
// 2. Call to something else, which might have a [[Call]] internal method (if
|
||||
// not we raise an exception).
|
||||
@ -1613,11 +1610,10 @@ void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
|
||||
// -- eax : the number of arguments (not including the receiver)
|
||||
// -- edx : the new target (either the same as the constructor or
|
||||
// the JSFunction on which new was invoked initially)
|
||||
// -- edi : the constructor to call (checked to be a JSFunctionProxy)
|
||||
// -- edi : the constructor to call (checked to be a JSProxy)
|
||||
// -----------------------------------
|
||||
|
||||
// TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
||||
__ mov(edi, FieldOperand(edi, JSFunctionProxy::kConstructTrapOffset));
|
||||
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
@ -1639,7 +1635,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
|
||||
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
|
||||
__ j(equal, masm->isolate()->builtins()->ConstructFunction(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
__ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
|
||||
__ CmpInstanceType(ecx, JS_PROXY_TYPE);
|
||||
__ j(equal, masm->isolate()->builtins()->ConstructProxy(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
|
||||
|
@ -32,9 +32,10 @@
|
||||
|
||||
function TestWithProxies(test, x, y, z) {
|
||||
test(function(h){ return new Proxy({}, h) }, x, y, z)
|
||||
test(function(h) {
|
||||
return Proxy.createFunction(h, function() {})
|
||||
}, x, y, z)
|
||||
// TODO(cbruni): enable once we have [[Call]] working.
|
||||
// test(function(h) {
|
||||
// return Proxy.createFunction(h, function() {})
|
||||
// }, x, y, z)
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,6 +87,7 @@
|
||||
|
||||
# Proxy tests rely on non ES6 version of Proxies
|
||||
# TODO(neis,cbruni): figure out which Proxy tests can be reused
|
||||
'es6/classes-proxy' : [SKIP],
|
||||
'es6/regress/regress-cr493566': [SKIP],
|
||||
'for-in-opt': [SKIP],
|
||||
'harmony/proxies-example-membrane': [SKIP],
|
||||
|
Loading…
Reference in New Issue
Block a user