| Index: src/ia32/code-stubs-ia32.cc
|
| ===================================================================
|
| --- src/ia32/code-stubs-ia32.cc (revision 8618)
|
| +++ src/ia32/code-stubs-ia32.cc (working copy)
|
| @@ -43,8 +43,7 @@
|
| void ToNumberStub::Generate(MacroAssembler* masm) {
|
| // The ToNumber stub takes one argument in eax.
|
| Label check_heap_number, call_builtin;
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &check_heap_number, Label::kNear);
|
| + __ JumpIfNotSmi(eax, &check_heap_number, Label::kNear);
|
| __ ret(0);
|
|
|
| __ bind(&check_heap_number);
|
| @@ -129,22 +128,19 @@
|
|
|
| // Setup the object header.
|
| Factory* factory = masm->isolate()->factory();
|
| - __ mov(FieldOperand(eax, HeapObject::kMapOffset), factory->context_map());
|
| + __ mov(FieldOperand(eax, HeapObject::kMapOffset),
|
| + factory->function_context_map());
|
| __ mov(FieldOperand(eax, Context::kLengthOffset),
|
| Immediate(Smi::FromInt(length)));
|
|
|
| // Setup the fixed slots.
|
| __ Set(ebx, Immediate(0)); // Set to NULL.
|
| __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx);
|
| - __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax);
|
| - __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx);
|
| + __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), esi);
|
| __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx);
|
|
|
| - // Copy the global object from the surrounding context. We go through the
|
| - // context in the function (ecx) to match the allocation behavior we have
|
| - // in the runtime system (see Heap::AllocateFunctionContext).
|
| - __ mov(ebx, FieldOperand(ecx, JSFunction::kContextOffset));
|
| - __ mov(ebx, Operand(ebx, Context::SlotOffset(Context::GLOBAL_INDEX)));
|
| + // Copy the global object from the previous context.
|
| + __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
|
| __ mov(Operand(eax, Context::SlotOffset(Context::GLOBAL_INDEX)), ebx);
|
|
|
| // Initialize the rest of the slots to undefined.
|
| @@ -159,7 +155,7 @@
|
|
|
| // Need to collect. Call into runtime system.
|
| __ bind(&gc);
|
| - __ TailCallRuntime(Runtime::kNewContext, 1, 1);
|
| + __ TailCallRuntime(Runtime::kNewFunctionContext, 1, 1);
|
| }
|
|
|
|
|
| @@ -240,56 +236,55 @@
|
| }
|
|
|
|
|
| -// NOTE: The stub does not handle the inlined cases (Smis, Booleans, undefined).
|
| +// The stub returns zero for false, and a non-zero value for true.
|
| void ToBooleanStub::Generate(MacroAssembler* masm) {
|
| Label false_result, true_result, not_string;
|
| - __ mov(eax, Operand(esp, 1 * kPointerSize));
|
| Factory* factory = masm->isolate()->factory();
|
| + const Register map = edx;
|
|
|
| + __ mov(eax, Operand(esp, 1 * kPointerSize));
|
| +
|
| // undefined -> false
|
| __ cmp(eax, factory->undefined_value());
|
| __ j(equal, &false_result);
|
|
|
| // Boolean -> its value
|
| + __ cmp(eax, factory->false_value());
|
| + __ j(equal, &false_result);
|
| __ cmp(eax, factory->true_value());
|
| __ j(equal, &true_result);
|
| - __ cmp(eax, factory->false_value());
|
| - __ j(equal, &false_result);
|
|
|
| // Smis: 0 -> false, all other -> true
|
| __ test(eax, Operand(eax));
|
| __ j(zero, &false_result);
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(zero, &true_result);
|
| + __ JumpIfSmi(eax, &true_result);
|
|
|
| - // 'null' => false.
|
| + // 'null' -> false.
|
| __ cmp(eax, factory->null_value());
|
| __ j(equal, &false_result, Label::kNear);
|
|
|
| - // Get the map and type of the heap object.
|
| - __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset));
|
| - __ movzx_b(ecx, FieldOperand(edx, Map::kInstanceTypeOffset));
|
| + // Get the map of the heap object.
|
| + __ mov(map, FieldOperand(eax, HeapObject::kMapOffset));
|
|
|
| - // Undetectable => false.
|
| - __ test_b(FieldOperand(edx, Map::kBitFieldOffset),
|
| + // Undetectable -> false.
|
| + __ test_b(FieldOperand(map, Map::kBitFieldOffset),
|
| 1 << Map::kIsUndetectable);
|
| __ j(not_zero, &false_result, Label::kNear);
|
|
|
| - // JavaScript object => true.
|
| - __ CmpInstanceType(edx, FIRST_JS_OBJECT_TYPE);
|
| + // JavaScript object -> true.
|
| + __ CmpInstanceType(map, FIRST_SPEC_OBJECT_TYPE);
|
| __ j(above_equal, &true_result, Label::kNear);
|
|
|
| - // String value => false iff empty.
|
| - __ CmpInstanceType(edx, FIRST_NONSTRING_TYPE);
|
| + // String value -> false iff empty.
|
| + __ CmpInstanceType(map, FIRST_NONSTRING_TYPE);
|
| __ j(above_equal, ¬_string, Label::kNear);
|
| - STATIC_ASSERT(kSmiTag == 0);
|
| __ cmp(FieldOperand(eax, String::kLengthOffset), Immediate(0));
|
| __ j(zero, &false_result, Label::kNear);
|
| __ jmp(&true_result, Label::kNear);
|
|
|
| __ bind(¬_string);
|
| - // HeapNumber => false iff +0, -0, or NaN.
|
| - __ cmp(edx, factory->heap_number_map());
|
| + // HeapNumber -> false iff +0, -0, or NaN.
|
| + __ cmp(map, factory->heap_number_map());
|
| __ j(not_equal, &true_result, Label::kNear);
|
| __ fldz();
|
| __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
|
| @@ -297,12 +292,12 @@
|
| __ j(zero, &false_result, Label::kNear);
|
| // Fall through to |true_result|.
|
|
|
| - // Return 1/0 for true/false in eax.
|
| + // Return 1/0 for true/false in tos_.
|
| __ bind(&true_result);
|
| - __ mov(eax, 1);
|
| + __ mov(tos_, 1);
|
| __ ret(1 * kPointerSize);
|
| __ bind(&false_result);
|
| - __ mov(eax, 0);
|
| + __ mov(tos_, 0);
|
| __ ret(1 * kPointerSize);
|
| }
|
|
|
| @@ -342,7 +337,6 @@
|
|
|
| class FloatingPointHelper : public AllStatic {
|
| public:
|
| -
|
| enum ArgLocation {
|
| ARGS_ON_STACK,
|
| ARGS_IN_REGISTERS
|
| @@ -550,12 +544,6 @@
|
| }
|
|
|
|
|
| -Handle<Code> GetUnaryOpStub(int key, UnaryOpIC::TypeInfo type_info) {
|
| - UnaryOpStub stub(key, type_info);
|
| - return stub.GetCode();
|
| -}
|
| -
|
| -
|
| const char* UnaryOpStub::GetName() {
|
| if (name_ != NULL) return name_;
|
| const int kMaxNameLength = 100;
|
| @@ -599,12 +587,10 @@
|
|
|
| void UnaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
|
| __ pop(ecx); // Save return address.
|
| - __ push(eax);
|
| - // the argument is now on top.
|
| - // Push this stub's key. Although the operation and the type info are
|
| - // encoded into the key, the encoding is opaque, so push them too.
|
| - __ push(Immediate(Smi::FromInt(MinorKey())));
|
| +
|
| + __ push(eax); // the operand
|
| __ push(Immediate(Smi::FromInt(op_)));
|
| + __ push(Immediate(Smi::FromInt(mode_)));
|
| __ push(Immediate(Smi::FromInt(operand_type_)));
|
|
|
| __ push(ecx); // Push return address.
|
| @@ -612,8 +598,7 @@
|
| // Patch the caller to an appropriate specialized stub and return the
|
| // operation result to the caller of the stub.
|
| __ TailCallExternalReference(
|
| - ExternalReference(IC_Utility(IC::kUnaryOp_Patch),
|
| - masm->isolate()), 4, 1);
|
| + ExternalReference(IC_Utility(IC::kUnaryOp_Patch), masm->isolate()), 4, 1);
|
| }
|
|
|
|
|
| @@ -660,8 +645,7 @@
|
| Label::Distance undo_near,
|
| Label::Distance slow_near) {
|
| // Check whether the value is a smi.
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, non_smi, non_smi_near);
|
| + __ JumpIfNotSmi(eax, non_smi, non_smi_near);
|
|
|
| // We can't handle -0 with smis, so use a type transition for that case.
|
| __ test(eax, Operand(eax));
|
| @@ -681,8 +665,7 @@
|
| Label* non_smi,
|
| Label::Distance non_smi_near) {
|
| // Check whether the value is a smi.
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, non_smi, non_smi_near);
|
| + __ JumpIfNotSmi(eax, non_smi, non_smi_near);
|
|
|
| // Flip bits and revert inverted smi-tag.
|
| __ not_(eax);
|
| @@ -886,14 +869,6 @@
|
| }
|
|
|
|
|
| -Handle<Code> GetBinaryOpStub(int key,
|
| - BinaryOpIC::TypeInfo type_info,
|
| - BinaryOpIC::TypeInfo result_type_info) {
|
| - BinaryOpStub stub(key, type_info, result_type_info);
|
| - return stub.GetCode();
|
| -}
|
| -
|
| -
|
| void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
|
| __ pop(ecx); // Save return address.
|
| __ push(edx);
|
| @@ -1056,8 +1031,7 @@
|
|
|
| // 3. Perform the smi check of the operands.
|
| STATIC_ASSERT(kSmiTag == 0); // Adjust zero check if not the case.
|
| - __ test(combined, Immediate(kSmiTagMask));
|
| - __ j(not_zero, ¬_smis);
|
| + __ JumpIfNotSmi(combined, ¬_smis);
|
|
|
| // 4. Operands are both smis, perform the operation leaving the result in
|
| // eax and check the result if necessary.
|
| @@ -1445,14 +1419,12 @@
|
| Register right = eax;
|
|
|
| // Test if left operand is a string.
|
| - __ test(left, Immediate(kSmiTagMask));
|
| - __ j(zero, &call_runtime);
|
| + __ JumpIfSmi(left, &call_runtime);
|
| __ CmpObjectType(left, FIRST_NONSTRING_TYPE, ecx);
|
| __ j(above_equal, &call_runtime);
|
|
|
| // Test if right operand is a string.
|
| - __ test(right, Immediate(kSmiTagMask));
|
| - __ j(zero, &call_runtime);
|
| + __ JumpIfSmi(right, &call_runtime);
|
| __ CmpObjectType(right, FIRST_NONSTRING_TYPE, ecx);
|
| __ j(above_equal, &call_runtime);
|
|
|
| @@ -1588,8 +1560,7 @@
|
| // allocation of a heap number.
|
| __ mov(eax, Operand(esp, mode_ == OVERWRITE_RIGHT ?
|
| 1 * kPointerSize : 2 * kPointerSize));
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &skip_allocation, Label::kNear);
|
| + __ JumpIfNotSmi(eax, &skip_allocation, Label::kNear);
|
| // Fall through!
|
| case NO_OVERWRITE:
|
| __ AllocateHeapNumber(eax, ecx, edx, &call_runtime);
|
| @@ -1803,8 +1774,7 @@
|
| // allocation of a heap number.
|
| __ mov(eax, Operand(esp, mode_ == OVERWRITE_RIGHT ?
|
| 1 * kPointerSize : 2 * kPointerSize));
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &skip_allocation, Label::kNear);
|
| + __ JumpIfNotSmi(eax, &skip_allocation, Label::kNear);
|
| // Fall through!
|
| case NO_OVERWRITE:
|
| __ AllocateHeapNumber(eax, ecx, edx, &call_runtime);
|
| @@ -2003,8 +1973,7 @@
|
| // allocation of a heap number.
|
| __ mov(eax, Operand(esp, mode_ == OVERWRITE_RIGHT ?
|
| 1 * kPointerSize : 2 * kPointerSize));
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &skip_allocation, Label::kNear);
|
| + __ JumpIfNotSmi(eax, &skip_allocation, Label::kNear);
|
| // Fall through!
|
| case NO_OVERWRITE:
|
| __ AllocateHeapNumber(eax, ecx, edx, &call_runtime);
|
| @@ -2087,8 +2056,7 @@
|
| Register right = eax;
|
|
|
| // Test if left operand is a string.
|
| - __ test(left, Immediate(kSmiTagMask));
|
| - __ j(zero, &left_not_string, Label::kNear);
|
| + __ JumpIfSmi(left, &left_not_string, Label::kNear);
|
| __ CmpObjectType(left, FIRST_NONSTRING_TYPE, ecx);
|
| __ j(above_equal, &left_not_string, Label::kNear);
|
|
|
| @@ -2098,8 +2066,7 @@
|
|
|
| // Left operand is not a string, test right.
|
| __ bind(&left_not_string);
|
| - __ test(right, Immediate(kSmiTagMask));
|
| - __ j(zero, &call_runtime, Label::kNear);
|
| + __ JumpIfSmi(right, &call_runtime, Label::kNear);
|
| __ CmpObjectType(right, FIRST_NONSTRING_TYPE, ecx);
|
| __ j(above_equal, &call_runtime, Label::kNear);
|
|
|
| @@ -2121,8 +2088,7 @@
|
| case OVERWRITE_LEFT: {
|
| // If the argument in edx is already an object, we skip the
|
| // allocation of a heap number.
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &skip_allocation);
|
| + __ JumpIfNotSmi(edx, &skip_allocation, Label::kNear);
|
| // Allocate a heap number for the result. Keep eax and edx intact
|
| // for the possible runtime call.
|
| __ AllocateHeapNumber(ebx, ecx, no_reg, alloc_failure);
|
| @@ -2137,8 +2103,7 @@
|
| case OVERWRITE_RIGHT:
|
| // If the argument in eax is already an object, we skip the
|
| // allocation of a heap number.
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &skip_allocation);
|
| + __ JumpIfNotSmi(eax, &skip_allocation, Label::kNear);
|
| // Fall through!
|
| case NO_OVERWRITE:
|
| // Allocate a heap number for the result. Keep eax and edx intact
|
| @@ -2185,8 +2150,7 @@
|
| Label input_not_smi;
|
| Label loaded;
|
| __ mov(eax, Operand(esp, kPointerSize));
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &input_not_smi, Label::kNear);
|
| + __ JumpIfNotSmi(eax, &input_not_smi, Label::kNear);
|
| // Input is a smi. Untag and load it onto the FPU stack.
|
| // Then load the low and high words of the double into ebx, edx.
|
| STATIC_ASSERT(kSmiTagSize == 1);
|
| @@ -2464,8 +2428,7 @@
|
| Label load_arg2, done;
|
|
|
| // Test if arg1 is a Smi.
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &arg1_is_object);
|
| + __ JumpIfNotSmi(edx, &arg1_is_object);
|
|
|
| __ SmiUntag(edx);
|
| __ jmp(&load_arg2);
|
| @@ -2491,8 +2454,7 @@
|
| __ bind(&load_arg2);
|
|
|
| // Test if arg2 is a Smi.
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &arg2_is_object);
|
| + __ JumpIfNotSmi(eax, &arg2_is_object);
|
|
|
| __ SmiUntag(eax);
|
| __ mov(ecx, eax);
|
| @@ -2528,8 +2490,7 @@
|
| Register number) {
|
| Label load_smi, done;
|
|
|
| - __ test(number, Immediate(kSmiTagMask));
|
| - __ j(zero, &load_smi, Label::kNear);
|
| + __ JumpIfSmi(number, &load_smi, Label::kNear);
|
| __ fld_d(FieldOperand(number, HeapNumber::kValueOffset));
|
| __ jmp(&done, Label::kNear);
|
|
|
| @@ -2546,16 +2507,12 @@
|
| void FloatingPointHelper::LoadSSE2Operands(MacroAssembler* masm) {
|
| Label load_smi_edx, load_eax, load_smi_eax, done;
|
| // Load operand in edx into xmm0.
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - // Argument in edx is a smi.
|
| - __ j(zero, &load_smi_edx, Label::kNear);
|
| + __ JumpIfSmi(edx, &load_smi_edx, Label::kNear);
|
| __ movdbl(xmm0, FieldOperand(edx, HeapNumber::kValueOffset));
|
|
|
| __ bind(&load_eax);
|
| // Load operand in eax into xmm1.
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - // Argument in eax is a smi.
|
| - __ j(zero, &load_smi_eax, Label::kNear);
|
| + __ JumpIfSmi(eax, &load_smi_eax, Label::kNear);
|
| __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset));
|
| __ jmp(&done, Label::kNear);
|
|
|
| @@ -2578,18 +2535,14 @@
|
| Label* not_numbers) {
|
| Label load_smi_edx, load_eax, load_smi_eax, load_float_eax, done;
|
| // Load operand in edx into xmm0, or branch to not_numbers.
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - // Argument in edx is a smi.
|
| - __ j(zero, &load_smi_edx, Label::kNear);
|
| + __ JumpIfSmi(edx, &load_smi_edx, Label::kNear);
|
| Factory* factory = masm->isolate()->factory();
|
| __ cmp(FieldOperand(edx, HeapObject::kMapOffset), factory->heap_number_map());
|
| __ j(not_equal, not_numbers); // Argument in edx is not a number.
|
| __ movdbl(xmm0, FieldOperand(edx, HeapNumber::kValueOffset));
|
| __ bind(&load_eax);
|
| // Load operand in eax into xmm1, or branch to not_numbers.
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - // Argument in eax is a smi.
|
| - __ j(zero, &load_smi_eax, Label::kNear);
|
| + __ JumpIfSmi(eax, &load_smi_eax, Label::kNear);
|
| __ cmp(FieldOperand(eax, HeapObject::kMapOffset), factory->heap_number_map());
|
| __ j(equal, &load_float_eax, Label::kNear);
|
| __ jmp(not_numbers); // Argument in eax is not a number.
|
| @@ -2649,8 +2602,7 @@
|
| } else {
|
| __ mov(scratch, Operand(esp, 2 * kPointerSize));
|
| }
|
| - __ test(scratch, Immediate(kSmiTagMask));
|
| - __ j(zero, &load_smi_1, Label::kNear);
|
| + __ JumpIfSmi(scratch, &load_smi_1, Label::kNear);
|
| __ fld_d(FieldOperand(scratch, HeapNumber::kValueOffset));
|
| __ bind(&done_load_1);
|
|
|
| @@ -2659,8 +2611,7 @@
|
| } else {
|
| __ mov(scratch, Operand(esp, 1 * kPointerSize));
|
| }
|
| - __ test(scratch, Immediate(kSmiTagMask));
|
| - __ j(zero, &load_smi_2, Label::kNear);
|
| + __ JumpIfSmi(scratch, &load_smi_2, Label::kNear);
|
| __ fld_d(FieldOperand(scratch, HeapNumber::kValueOffset));
|
| __ jmp(&done, Label::kNear);
|
|
|
| @@ -2705,16 +2656,14 @@
|
| Label test_other, done;
|
| // Test if both operands are floats or smi -> scratch=k_is_float;
|
| // Otherwise scratch = k_not_float.
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - __ j(zero, &test_other, Label::kNear); // argument in edx is OK
|
| + __ JumpIfSmi(edx, &test_other, Label::kNear);
|
| __ mov(scratch, FieldOperand(edx, HeapObject::kMapOffset));
|
| Factory* factory = masm->isolate()->factory();
|
| __ cmp(scratch, factory->heap_number_map());
|
| __ j(not_equal, non_float); // argument in edx is not a number -> NaN
|
|
|
| __ bind(&test_other);
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(zero, &done, Label::kNear); // argument in eax is OK
|
| + __ JumpIfSmi(eax, &done, Label::kNear);
|
| __ mov(scratch, FieldOperand(eax, HeapObject::kMapOffset));
|
| __ cmp(scratch, factory->heap_number_map());
|
| __ j(not_equal, non_float); // argument in eax is not a number -> NaN
|
| @@ -2750,10 +2699,8 @@
|
| Label exponent_nonsmi;
|
| Label base_nonsmi;
|
| // If the exponent is a heap number go to that specific case.
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &exponent_nonsmi);
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &base_nonsmi);
|
| + __ JumpIfNotSmi(eax, &exponent_nonsmi);
|
| + __ JumpIfNotSmi(edx, &base_nonsmi);
|
|
|
| // Optimized version when both exponent and base are smis.
|
| Label powi;
|
| @@ -2825,8 +2772,7 @@
|
|
|
| Label base_not_smi;
|
| Label handle_special_cases;
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &base_not_smi, Label::kNear);
|
| + __ JumpIfNotSmi(edx, &base_not_smi, Label::kNear);
|
| __ SmiUntag(edx);
|
| __ cvtsi2sd(xmm0, Operand(edx));
|
| __ jmp(&handle_special_cases, Label::kNear);
|
| @@ -2898,8 +2844,7 @@
|
|
|
| // Check that the key is a smi.
|
| Label slow;
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &slow);
|
| + __ JumpIfNotSmi(edx, &slow);
|
|
|
| // Check if the calling frame is an arguments adaptor frame.
|
| Label adaptor;
|
| @@ -2948,18 +2893,261 @@
|
| }
|
|
|
|
|
| -void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
|
| +void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) {
|
| // esp[0] : return address
|
| // esp[4] : number of parameters
|
| // esp[8] : receiver displacement
|
| - // esp[16] : function
|
| + // esp[12] : function
|
|
|
| - // The displacement is used for skipping the return address and the
|
| - // frame pointer on the stack. It is the offset of the last
|
| - // parameter (if any) relative to the frame pointer.
|
| - static const int kDisplacement = 2 * kPointerSize;
|
| + // Check if the calling frame is an arguments adaptor frame.
|
| + Label runtime;
|
| + __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
|
| + __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
|
| + __ cmp(Operand(ecx), Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
|
| + __ j(not_equal, &runtime, Label::kNear);
|
|
|
| + // Patch the arguments.length and the parameters pointer.
|
| + __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
|
| + __ mov(Operand(esp, 1 * kPointerSize), ecx);
|
| + __ lea(edx, Operand(edx, ecx, times_2,
|
| + StandardFrameConstants::kCallerSPOffset));
|
| + __ mov(Operand(esp, 2 * kPointerSize), edx);
|
| +
|
| + __ bind(&runtime);
|
| + __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1);
|
| +}
|
| +
|
| +
|
| +void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
| + // esp[0] : return address
|
| + // esp[4] : number of parameters (tagged)
|
| + // esp[8] : receiver displacement
|
| + // esp[12] : function
|
| +
|
| + // ebx = parameter count (tagged)
|
| + __ mov(ebx, Operand(esp, 1 * kPointerSize));
|
| +
|
| // Check if the calling frame is an arguments adaptor frame.
|
| + // TODO(rossberg): Factor out some of the bits that are shared with the other
|
| + // Generate* functions.
|
| + Label runtime;
|
| + Label adaptor_frame, try_allocate;
|
| + __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
|
| + __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
|
| + __ cmp(Operand(ecx), Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
|
| + __ j(equal, &adaptor_frame, Label::kNear);
|
| +
|
| + // No adaptor, parameter count = argument count.
|
| + __ mov(ecx, ebx);
|
| + __ jmp(&try_allocate, Label::kNear);
|
| +
|
| + // We have an adaptor frame. Patch the parameters pointer.
|
| + __ bind(&adaptor_frame);
|
| + __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
|
| + __ lea(edx, Operand(edx, ecx, times_2,
|
| + StandardFrameConstants::kCallerSPOffset));
|
| + __ mov(Operand(esp, 2 * kPointerSize), edx);
|
| +
|
| + // ebx = parameter count (tagged)
|
| + // ecx = argument count (tagged)
|
| + // esp[4] = parameter count (tagged)
|
| + // esp[8] = address of receiver argument
|
| + // Compute the mapped parameter count = min(ebx, ecx) in ebx.
|
| + __ cmp(ebx, Operand(ecx));
|
| + __ j(less_equal, &try_allocate, Label::kNear);
|
| + __ mov(ebx, ecx);
|
| +
|
| + __ bind(&try_allocate);
|
| +
|
| + // Save mapped parameter count.
|
| + __ push(ebx);
|
| +
|
| + // Compute the sizes of backing store, parameter map, and arguments object.
|
| + // 1. Parameter map, has 2 extra words containing context and backing store.
|
| + const int kParameterMapHeaderSize =
|
| + FixedArray::kHeaderSize + 2 * kPointerSize;
|
| + Label no_parameter_map;
|
| + __ test(ebx, Operand(ebx));
|
| + __ j(zero, &no_parameter_map, Label::kNear);
|
| + __ lea(ebx, Operand(ebx, times_2, kParameterMapHeaderSize));
|
| + __ bind(&no_parameter_map);
|
| +
|
| + // 2. Backing store.
|
| + __ lea(ebx, Operand(ebx, ecx, times_2, FixedArray::kHeaderSize));
|
| +
|
| + // 3. Arguments object.
|
| + __ add(Operand(ebx), Immediate(Heap::kArgumentsObjectSize));
|
| +
|
| + // Do the allocation of all three objects in one go.
|
| + __ AllocateInNewSpace(ebx, eax, edx, edi, &runtime, TAG_OBJECT);
|
| +
|
| + // eax = address of new object(s) (tagged)
|
| + // ecx = argument count (tagged)
|
| + // esp[0] = mapped parameter count (tagged)
|
| + // esp[8] = parameter count (tagged)
|
| + // esp[12] = address of receiver argument
|
| + // Get the arguments boilerplate from the current (global) context into edi.
|
| + Label has_mapped_parameters, copy;
|
| + __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
|
| + __ mov(edi, FieldOperand(edi, GlobalObject::kGlobalContextOffset));
|
| + __ mov(ebx, Operand(esp, 0 * kPointerSize));
|
| + __ test(ebx, Operand(ebx));
|
| + __ j(not_zero, &has_mapped_parameters, Label::kNear);
|
| + __ mov(edi, Operand(edi,
|
| + Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX)));
|
| + __ jmp(©, Label::kNear);
|
| +
|
| + __ bind(&has_mapped_parameters);
|
| + __ mov(edi, Operand(edi,
|
| + Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX)));
|
| + __ bind(©);
|
| +
|
| + // eax = address of new object (tagged)
|
| + // ebx = mapped parameter count (tagged)
|
| + // ecx = argument count (tagged)
|
| + // edi = address of boilerplate object (tagged)
|
| + // esp[0] = mapped parameter count (tagged)
|
| + // esp[8] = parameter count (tagged)
|
| + // esp[12] = address of receiver argument
|
| + // Copy the JS object part.
|
| + for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) {
|
| + __ mov(edx, FieldOperand(edi, i));
|
| + __ mov(FieldOperand(eax, i), edx);
|
| + }
|
| +
|
| + // Setup the callee in-object property.
|
| + STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1);
|
| + __ mov(edx, Operand(esp, 4 * kPointerSize));
|
| + __ mov(FieldOperand(eax, JSObject::kHeaderSize +
|
| + Heap::kArgumentsCalleeIndex * kPointerSize),
|
| + edx);
|
| +
|
| + // Use the length (smi tagged) and set that as an in-object property too.
|
| + STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0);
|
| + __ mov(FieldOperand(eax, JSObject::kHeaderSize +
|
| + Heap::kArgumentsLengthIndex * kPointerSize),
|
| + ecx);
|
| +
|
| + // Setup the elements pointer in the allocated arguments object.
|
| + // If we allocated a parameter map, edi will point there, otherwise to the
|
| + // backing store.
|
| + __ lea(edi, Operand(eax, Heap::kArgumentsObjectSize));
|
| + __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi);
|
| +
|
| + // eax = address of new object (tagged)
|
| + // ebx = mapped parameter count (tagged)
|
| + // ecx = argument count (tagged)
|
| + // edi = address of parameter map or backing store (tagged)
|
| + // esp[0] = mapped parameter count (tagged)
|
| + // esp[8] = parameter count (tagged)
|
| + // esp[12] = address of receiver argument
|
| + // Free a register.
|
| + __ push(eax);
|
| +
|
| + // Initialize parameter map. If there are no mapped arguments, we're done.
|
| + Label skip_parameter_map;
|
| + __ test(ebx, Operand(ebx));
|
| + __ j(zero, &skip_parameter_map);
|
| +
|
| + __ mov(FieldOperand(edi, FixedArray::kMapOffset),
|
| + Immediate(FACTORY->non_strict_arguments_elements_map()));
|
| + __ lea(eax, Operand(ebx, reinterpret_cast<intptr_t>(Smi::FromInt(2))));
|
| + __ mov(FieldOperand(edi, FixedArray::kLengthOffset), eax);
|
| + __ mov(FieldOperand(edi, FixedArray::kHeaderSize + 0 * kPointerSize), esi);
|
| + __ lea(eax, Operand(edi, ebx, times_2, kParameterMapHeaderSize));
|
| + __ mov(FieldOperand(edi, FixedArray::kHeaderSize + 1 * kPointerSize), eax);
|
| +
|
| + // Copy the parameter slots and the holes in the arguments.
|
| + // We need to fill in mapped_parameter_count slots. They index the context,
|
| + // where parameters are stored in reverse order, at
|
| + // MIN_CONTEXT_SLOTS .. MIN_CONTEXT_SLOTS+parameter_count-1
|
| + // The mapped parameter thus need to get indices
|
| + // MIN_CONTEXT_SLOTS+parameter_count-1 ..
|
| + // MIN_CONTEXT_SLOTS+parameter_count-mapped_parameter_count
|
| + // We loop from right to left.
|
| + Label parameters_loop, parameters_test;
|
| + __ push(ecx);
|
| + __ mov(eax, Operand(esp, 2 * kPointerSize));
|
| + __ mov(ebx, Immediate(Smi::FromInt(Context::MIN_CONTEXT_SLOTS)));
|
| + __ add(ebx, Operand(esp, 4 * kPointerSize));
|
| + __ sub(ebx, Operand(eax));
|
| + __ mov(ecx, FACTORY->the_hole_value());
|
| + __ mov(edx, edi);
|
| + __ lea(edi, Operand(edi, eax, times_2, kParameterMapHeaderSize));
|
| + // eax = loop variable (tagged)
|
| + // ebx = mapping index (tagged)
|
| + // ecx = the hole value
|
| + // edx = address of parameter map (tagged)
|
| + // edi = address of backing store (tagged)
|
| + // esp[0] = argument count (tagged)
|
| + // esp[4] = address of new object (tagged)
|
| + // esp[8] = mapped parameter count (tagged)
|
| + // esp[16] = parameter count (tagged)
|
| + // esp[20] = address of receiver argument
|
| + __ jmp(¶meters_test, Label::kNear);
|
| +
|
| + __ bind(¶meters_loop);
|
| + __ sub(Operand(eax), Immediate(Smi::FromInt(1)));
|
| + __ mov(FieldOperand(edx, eax, times_2, kParameterMapHeaderSize), ebx);
|
| + __ mov(FieldOperand(edi, eax, times_2, FixedArray::kHeaderSize), ecx);
|
| + __ add(Operand(ebx), Immediate(Smi::FromInt(1)));
|
| + __ bind(¶meters_test);
|
| + __ test(eax, Operand(eax));
|
| + __ j(not_zero, ¶meters_loop, Label::kNear);
|
| + __ pop(ecx);
|
| +
|
| + __ bind(&skip_parameter_map);
|
| +
|
| + // ecx = argument count (tagged)
|
| + // edi = address of backing store (tagged)
|
| + // esp[0] = address of new object (tagged)
|
| + // esp[4] = mapped parameter count (tagged)
|
| + // esp[12] = parameter count (tagged)
|
| + // esp[16] = address of receiver argument
|
| + // Copy arguments header and remaining slots (if there are any).
|
| + __ mov(FieldOperand(edi, FixedArray::kMapOffset),
|
| + Immediate(FACTORY->fixed_array_map()));
|
| + __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx);
|
| +
|
| + Label arguments_loop, arguments_test;
|
| + __ mov(ebx, Operand(esp, 1 * kPointerSize));
|
| + __ mov(edx, Operand(esp, 4 * kPointerSize));
|
| + __ sub(Operand(edx), ebx); // Is there a smarter way to do negative scaling?
|
| + __ sub(Operand(edx), ebx);
|
| + __ jmp(&arguments_test, Label::kNear);
|
| +
|
| + __ bind(&arguments_loop);
|
| + __ sub(Operand(edx), Immediate(kPointerSize));
|
| + __ mov(eax, Operand(edx, 0));
|
| + __ mov(FieldOperand(edi, ebx, times_2, FixedArray::kHeaderSize), eax);
|
| + __ add(Operand(ebx), Immediate(Smi::FromInt(1)));
|
| +
|
| + __ bind(&arguments_test);
|
| + __ cmp(ebx, Operand(ecx));
|
| + __ j(less, &arguments_loop, Label::kNear);
|
| +
|
| + // Restore.
|
| + __ pop(eax); // Address of arguments object.
|
| + __ pop(ebx); // Parameter count.
|
| +
|
| + // Return and remove the on-stack parameters.
|
| + __ ret(3 * kPointerSize);
|
| +
|
| + // Do the runtime call to allocate the arguments object.
|
| + __ bind(&runtime);
|
| + __ pop(eax); // Remove saved parameter count.
|
| + __ mov(Operand(esp, 1 * kPointerSize), ecx); // Patch argument count.
|
| + __ TailCallRuntime(Runtime::kNewStrictArgumentsFast, 3, 1);
|
| +}
|
| +
|
| +
|
| +void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
|
| + // esp[0] : return address
|
| + // esp[4] : number of parameters
|
| + // esp[8] : receiver displacement
|
| + // esp[12] : function
|
| +
|
| + // Check if the calling frame is an arguments adaptor frame.
|
| Label adaptor_frame, try_allocate, runtime;
|
| __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
|
| __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
|
| @@ -2974,7 +3162,8 @@
|
| __ bind(&adaptor_frame);
|
| __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
|
| __ mov(Operand(esp, 1 * kPointerSize), ecx);
|
| - __ lea(edx, Operand(edx, ecx, times_2, kDisplacement));
|
| + __ lea(edx, Operand(edx, ecx, times_2,
|
| + StandardFrameConstants::kCallerSPOffset));
|
| __ mov(Operand(esp, 2 * kPointerSize), edx);
|
|
|
| // Try the new space allocation. Start out with computing the size of
|
| @@ -2985,7 +3174,7 @@
|
| __ j(zero, &add_arguments_object, Label::kNear);
|
| __ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize));
|
| __ bind(&add_arguments_object);
|
| - __ add(Operand(ecx), Immediate(GetArgumentsObjectSize()));
|
| + __ add(Operand(ecx), Immediate(Heap::kArgumentsObjectSizeStrict));
|
|
|
| // Do the allocation of both objects in one go.
|
| __ AllocateInNewSpace(ecx, eax, edx, ebx, &runtime, TAG_OBJECT);
|
| @@ -2993,8 +3182,9 @@
|
| // Get the arguments boilerplate from the current (global) context.
|
| __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
|
| __ mov(edi, FieldOperand(edi, GlobalObject::kGlobalContextOffset));
|
| - __ mov(edi, Operand(edi,
|
| - Context::SlotOffset(GetArgumentsBoilerplateIndex())));
|
| + const int offset =
|
| + Context::SlotOffset(Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX);
|
| + __ mov(edi, Operand(edi, offset));
|
|
|
| // Copy the JS object part.
|
| for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) {
|
| @@ -3002,20 +3192,11 @@
|
| __ mov(FieldOperand(eax, i), ebx);
|
| }
|
|
|
| - if (type_ == NEW_NON_STRICT) {
|
| - // Setup the callee in-object property.
|
| - STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1);
|
| - __ mov(ebx, Operand(esp, 3 * kPointerSize));
|
| - __ mov(FieldOperand(eax, JSObject::kHeaderSize +
|
| - Heap::kArgumentsCalleeIndex * kPointerSize),
|
| - ebx);
|
| - }
|
| -
|
| // Get the length (smi tagged) and set that as an in-object property too.
|
| STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0);
|
| __ mov(ecx, Operand(esp, 1 * kPointerSize));
|
| __ mov(FieldOperand(eax, JSObject::kHeaderSize +
|
| - Heap::kArgumentsLengthIndex * kPointerSize),
|
| + Heap::kArgumentsLengthIndex * kPointerSize),
|
| ecx);
|
|
|
| // If there are no actual arguments, we're done.
|
| @@ -3028,10 +3209,10 @@
|
|
|
| // Setup the elements pointer in the allocated arguments object and
|
| // initialize the header in the elements fixed array.
|
| - __ lea(edi, Operand(eax, GetArgumentsObjectSize()));
|
| + __ lea(edi, Operand(eax, Heap::kArgumentsObjectSizeStrict));
|
| __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi);
|
| __ mov(FieldOperand(edi, FixedArray::kMapOffset),
|
| - Immediate(masm->isolate()->factory()->fixed_array_map()));
|
| + Immediate(FACTORY->fixed_array_map()));
|
|
|
| __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx);
|
| // Untag the length for the loop below.
|
| @@ -3053,7 +3234,7 @@
|
|
|
| // Do the runtime call to allocate the arguments object.
|
| __ bind(&runtime);
|
| - __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1);
|
| + __ TailCallRuntime(Runtime::kNewStrictArgumentsFast, 3, 1);
|
| }
|
|
|
|
|
| @@ -3096,8 +3277,7 @@
|
| // Check that the first argument is a JSRegExp object.
|
| __ mov(eax, Operand(esp, kJSRegExpOffset));
|
| STATIC_ASSERT(kSmiTag == 0);
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(zero, &runtime);
|
| + __ JumpIfSmi(eax, &runtime);
|
| __ CmpObjectType(eax, JS_REGEXP_TYPE, ecx);
|
| __ j(not_equal, &runtime);
|
| // Check that the RegExp has been compiled (data contains a fixed array).
|
| @@ -3131,8 +3311,7 @@
|
| // edx: Number of capture registers
|
| // Check that the second argument is a string.
|
| __ mov(eax, Operand(esp, kSubjectOffset));
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(zero, &runtime);
|
| + __ JumpIfSmi(eax, &runtime);
|
| Condition is_string = masm->IsObjectStringType(eax, ebx, ebx);
|
| __ j(NegateCondition(is_string), &runtime);
|
| // Get the length of the string to ebx.
|
| @@ -3144,8 +3323,7 @@
|
| // Check that the third argument is a positive smi less than the subject
|
| // string length. A negative value will be greater (unsigned comparison).
|
| __ mov(eax, Operand(esp, kPreviousIndexOffset));
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &runtime);
|
| + __ JumpIfNotSmi(eax, &runtime);
|
| __ cmp(eax, Operand(ebx));
|
| __ j(above_equal, &runtime);
|
|
|
| @@ -3153,8 +3331,7 @@
|
| // edx: Number of capture registers
|
| // Check that the fourth object is a JSArray object.
|
| __ mov(eax, Operand(esp, kLastMatchInfoOffset));
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(zero, &runtime);
|
| + __ JumpIfSmi(eax, &runtime);
|
| __ CmpObjectType(eax, JS_ARRAY_TYPE, ebx);
|
| __ j(not_equal, &runtime);
|
| // Check that the JSArray is in fast case.
|
| @@ -3232,9 +3409,8 @@
|
| __ bind(&check_code);
|
| // Check that the irregexp code has been generated for the actual string
|
| // encoding. If it has, the field contains a code object otherwise it contains
|
| - // the hole.
|
| - __ CmpObjectType(edx, CODE_TYPE, ebx);
|
| - __ j(not_equal, &runtime);
|
| + // a smi (code flushing support).
|
| + __ JumpIfSmi(edx, &runtime);
|
|
|
| // eax: subject string
|
| // edx: code
|
| @@ -3432,8 +3608,7 @@
|
| Label slowcase;
|
| Label done;
|
| __ mov(ebx, Operand(esp, kPointerSize * 3));
|
| - __ test(ebx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &slowcase);
|
| + __ JumpIfNotSmi(ebx, &slowcase);
|
| __ cmp(Operand(ebx), Immediate(Smi::FromInt(kMaxInlineLength)));
|
| __ j(above, &slowcase);
|
| // Smi-tagging is equivalent to multiplying by 2.
|
| @@ -3545,8 +3720,7 @@
|
| } else {
|
| Label not_smi;
|
| STATIC_ASSERT(kSmiTag == 0);
|
| - __ test(object, Immediate(kSmiTagMask));
|
| - __ j(not_zero, ¬_smi, Label::kNear);
|
| + __ JumpIfNotSmi(object, ¬_smi, Label::kNear);
|
| __ mov(scratch, object);
|
| __ SmiUntag(scratch);
|
| __ jmp(&smi_hash_calculated, Label::kNear);
|
| @@ -3566,8 +3740,7 @@
|
| index,
|
| times_twice_pointer_size,
|
| FixedArray::kHeaderSize));
|
| - __ test(probe, Immediate(kSmiTagMask));
|
| - __ j(zero, not_found);
|
| + __ JumpIfSmi(probe, not_found);
|
| if (CpuFeatures::IsSupported(SSE2)) {
|
| CpuFeatures::Scope fscope(SSE2);
|
| __ movdbl(xmm0, FieldOperand(object, HeapNumber::kValueOffset));
|
| @@ -3639,8 +3812,7 @@
|
| Label non_smi, smi_done;
|
| __ mov(ecx, Operand(edx));
|
| __ or_(ecx, Operand(eax));
|
| - __ test(ecx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &non_smi);
|
| + __ JumpIfNotSmi(ecx, &non_smi);
|
| __ sub(edx, Operand(eax)); // Return on the result of the subtraction.
|
| __ j(no_overflow, &smi_done);
|
| __ not_(edx); // Correct sign in case of overflow. edx is never 0 here.
|
| @@ -3689,7 +3861,7 @@
|
| __ j(equal, &heap_number, Label::kNear);
|
| if (cc_ != equal) {
|
| // Call runtime on identical JSObjects. Otherwise return equal.
|
| - __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx);
|
| + __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
|
| __ j(above_equal, ¬_identical);
|
| }
|
| __ Set(eax, Immediate(Smi::FromInt(EQUAL)));
|
| @@ -3777,8 +3949,8 @@
|
| // Get the type of the first operand.
|
| // If the first object is a JS object, we have done pointer comparison.
|
| Label first_non_object;
|
| - STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
|
| - __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx);
|
| + STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE);
|
| + __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
|
| __ j(below, &first_non_object, Label::kNear);
|
|
|
| // Return non-zero (eax is not zero)
|
| @@ -3792,7 +3964,7 @@
|
| __ CmpInstanceType(ecx, ODDBALL_TYPE);
|
| __ j(equal, &return_not_equal);
|
|
|
| - __ CmpObjectType(edx, FIRST_JS_OBJECT_TYPE, ecx);
|
| + __ CmpObjectType(edx, FIRST_SPEC_OBJECT_TYPE, ecx);
|
| __ j(above_equal, &return_not_equal);
|
|
|
| // Check for oddballs: true, false, null, undefined.
|
| @@ -3916,9 +4088,9 @@
|
| __ lea(ecx, Operand(eax, edx, times_1, 0));
|
| __ test(ecx, Immediate(kSmiTagMask));
|
| __ j(not_zero, ¬_both_objects, Label::kNear);
|
| - __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx);
|
| + __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
|
| __ j(below, ¬_both_objects, Label::kNear);
|
| - __ CmpObjectType(edx, FIRST_JS_OBJECT_TYPE, ebx);
|
| + __ CmpObjectType(edx, FIRST_SPEC_OBJECT_TYPE, ebx);
|
| __ j(below, ¬_both_objects, Label::kNear);
|
| // We do not bail out after this point. Both are JSObjects, and
|
| // they are equal if and only if both are undetectable.
|
| @@ -3966,8 +4138,7 @@
|
| Label* label,
|
| Register object,
|
| Register scratch) {
|
| - __ test(object, Immediate(kSmiTagMask));
|
| - __ j(zero, label);
|
| + __ JumpIfSmi(object, label);
|
| __ mov(scratch, FieldOperand(object, HeapObject::kMapOffset));
|
| __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset));
|
| __ and_(scratch, kIsSymbolMask | kIsNotStringMask);
|
| @@ -4007,8 +4178,7 @@
|
| __ mov(edi, Operand(esp, (argc_ + 2) * kPointerSize));
|
|
|
| // Check that the function really is a JavaScript function.
|
| - __ test(edi, Immediate(kSmiTagMask));
|
| - __ j(zero, &slow);
|
| + __ JumpIfSmi(edi, &slow);
|
| // Goto slow case if we do not have a function.
|
| __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
|
| __ j(not_equal, &slow);
|
| @@ -4020,7 +4190,11 @@
|
| Label call_as_function;
|
| __ cmp(eax, masm->isolate()->factory()->the_hole_value());
|
| __ j(equal, &call_as_function);
|
| - __ InvokeFunction(edi, actual, JUMP_FUNCTION);
|
| + __ InvokeFunction(edi,
|
| + actual,
|
| + JUMP_FUNCTION,
|
| + NullCallWrapper(),
|
| + CALL_AS_METHOD);
|
| __ bind(&call_as_function);
|
| }
|
| __ InvokeFunction(edi,
|
| @@ -4403,8 +4577,7 @@
|
| }
|
|
|
| // Check that the left hand is a JS object.
|
| - __ test(object, Immediate(kSmiTagMask));
|
| - __ j(zero, ¬_js_object);
|
| + __ JumpIfSmi(object, ¬_js_object);
|
| __ IsObjectJSObjectType(object, map, scratch, ¬_js_object);
|
|
|
| // If there is a call site cache don't look in the global cache, but do the
|
| @@ -4431,8 +4604,7 @@
|
| __ TryGetFunctionPrototype(function, prototype, scratch, &slow);
|
|
|
| // Check that the function prototype is a JS object.
|
| - __ test(prototype, Immediate(kSmiTagMask));
|
| - __ j(zero, &slow);
|
| + __ JumpIfSmi(prototype, &slow);
|
| __ IsObjectJSObjectType(prototype, scratch, scratch, &slow);
|
|
|
| // Update the global instanceof or call site inlined cache with the current
|
| @@ -4521,8 +4693,7 @@
|
| __ bind(¬_js_object);
|
| // Before null, smi and string value checks, check that the rhs is a function
|
| // as for a non-function rhs an exception needs to be thrown.
|
| - __ test(function, Immediate(kSmiTagMask));
|
| - __ j(zero, &slow);
|
| + __ JumpIfSmi(function, &slow);
|
| __ CmpObjectType(function, JS_FUNCTION_TYPE, scratch);
|
| __ j(not_equal, &slow);
|
|
|
| @@ -4534,8 +4705,7 @@
|
|
|
| __ bind(&object_not_null);
|
| // Smi values is not instance of anything.
|
| - __ test(object, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &object_not_null_or_smi);
|
| + __ JumpIfNotSmi(object, &object_not_null_or_smi);
|
| __ Set(eax, Immediate(Smi::FromInt(1)));
|
| __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize);
|
|
|
| @@ -4662,8 +4832,7 @@
|
|
|
| // If the receiver is a smi trigger the non-string case.
|
| STATIC_ASSERT(kSmiTag == 0);
|
| - __ test(object_, Immediate(kSmiTagMask));
|
| - __ j(zero, receiver_not_string_);
|
| + __ JumpIfSmi(object_, receiver_not_string_);
|
|
|
| // Fetch the instance type of the receiver into result register.
|
| __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset));
|
| @@ -4674,8 +4843,7 @@
|
|
|
| // If the index is non-smi trigger the non-smi case.
|
| STATIC_ASSERT(kSmiTag == 0);
|
| - __ test(index_, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &index_not_smi_);
|
| + __ JumpIfNotSmi(index_, &index_not_smi_);
|
|
|
| // Put smi-tagged index into scratch register.
|
| __ mov(scratch_, index_);
|
| @@ -4773,8 +4941,7 @@
|
| call_helper.AfterCall(masm);
|
| // If index is still not a smi, it must be out of range.
|
| STATIC_ASSERT(kSmiTag == 0);
|
| - __ test(scratch_, Immediate(kSmiTagMask));
|
| - __ j(not_zero, index_out_of_range_);
|
| + __ JumpIfNotSmi(scratch_, index_out_of_range_);
|
| // Otherwise, return to the fast path.
|
| __ jmp(&got_smi_index_);
|
|
|
| @@ -4868,14 +5035,12 @@
|
|
|
| // Make sure that both arguments are strings if not known in advance.
|
| if (flags_ == NO_STRING_ADD_FLAGS) {
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(zero, &string_add_runtime);
|
| + __ JumpIfSmi(eax, &string_add_runtime);
|
| __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, ebx);
|
| __ j(above_equal, &string_add_runtime);
|
|
|
| // First argument is a a string, test second.
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - __ j(zero, &string_add_runtime);
|
| + __ JumpIfSmi(edx, &string_add_runtime);
|
| __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, ebx);
|
| __ j(above_equal, &string_add_runtime);
|
| } else {
|
| @@ -5143,8 +5308,7 @@
|
| Label* slow) {
|
| // First check if the argument is already a string.
|
| Label not_string, done;
|
| - __ test(arg, Immediate(kSmiTagMask));
|
| - __ j(zero, ¬_string);
|
| + __ JumpIfSmi(arg, ¬_string);
|
| __ CmpObjectType(arg, FIRST_NONSTRING_TYPE, scratch1);
|
| __ j(below, &done);
|
|
|
| @@ -5165,8 +5329,7 @@
|
|
|
| // Check if the argument is a safe string wrapper.
|
| __ bind(¬_cached);
|
| - __ test(arg, Immediate(kSmiTagMask));
|
| - __ j(zero, slow);
|
| + __ JumpIfSmi(arg, slow);
|
| __ CmpObjectType(arg, JS_VALUE_TYPE, scratch1); // map -> scratch1.
|
| __ j(not_equal, slow);
|
| __ test_b(FieldOperand(scratch1, Map::kBitField2Offset),
|
| @@ -5460,8 +5623,7 @@
|
| // Make sure first argument is a string.
|
| __ mov(eax, Operand(esp, 3 * kPointerSize));
|
| STATIC_ASSERT(kSmiTag == 0);
|
| - __ test(eax, Immediate(kSmiTagMask));
|
| - __ j(zero, &runtime);
|
| + __ JumpIfSmi(eax, &runtime);
|
| Condition is_string = masm->IsObjectStringType(eax, ebx, ebx);
|
| __ j(NegateCondition(is_string), &runtime);
|
|
|
| @@ -5471,11 +5633,9 @@
|
| // Calculate length of sub string using the smi values.
|
| Label result_longer_than_two;
|
| __ mov(ecx, Operand(esp, 1 * kPointerSize)); // To index.
|
| - __ test(ecx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &runtime);
|
| + __ JumpIfNotSmi(ecx, &runtime);
|
| __ mov(edx, Operand(esp, 2 * kPointerSize)); // From index.
|
| - __ test(edx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &runtime);
|
| + __ JumpIfNotSmi(edx, &runtime);
|
| __ sub(ecx, Operand(edx));
|
| __ cmp(ecx, FieldOperand(eax, String::kLengthOffset));
|
| Label return_eax;
|
| @@ -5767,8 +5927,7 @@
|
| Label miss;
|
| __ mov(ecx, Operand(edx));
|
| __ or_(ecx, Operand(eax));
|
| - __ test(ecx, Immediate(kSmiTagMask));
|
| - __ j(not_zero, &miss, Label::kNear);
|
| + __ JumpIfNotSmi(ecx, &miss, Label::kNear);
|
|
|
| if (GetCondition() == equal) {
|
| // For equality we do not care about the sign of the result.
|
| @@ -5797,8 +5956,7 @@
|
| Label miss;
|
| __ mov(ecx, Operand(edx));
|
| __ and_(ecx, Operand(eax));
|
| - __ test(ecx, Immediate(kSmiTagMask));
|
| - __ j(zero, &generic_stub, Label::kNear);
|
| + __ JumpIfSmi(ecx, &generic_stub, Label::kNear);
|
|
|
| __ CmpObjectType(eax, HEAP_NUMBER_TYPE, ecx);
|
| __ j(not_equal, &miss, Label::kNear);
|
| @@ -5857,8 +6015,7 @@
|
| __ mov(tmp1, Operand(left));
|
| STATIC_ASSERT(kSmiTag == 0);
|
| __ and_(tmp1, Operand(right));
|
| - __ test(tmp1, Immediate(kSmiTagMask));
|
| - __ j(zero, &miss, Label::kNear);
|
| + __ JumpIfSmi(tmp1, &miss, Label::kNear);
|
|
|
| // Check that both operands are symbols.
|
| __ mov(tmp1, FieldOperand(left, HeapObject::kMapOffset));
|
| @@ -5904,8 +6061,7 @@
|
| __ mov(tmp1, Operand(left));
|
| STATIC_ASSERT(kSmiTag == 0);
|
| __ and_(tmp1, Operand(right));
|
| - __ test(tmp1, Immediate(kSmiTagMask));
|
| - __ j(zero, &miss);
|
| + __ JumpIfSmi(tmp1, &miss);
|
|
|
| // Check that both operands are strings. This leaves the instance
|
| // types loaded in tmp1 and tmp2.
|
| @@ -5970,8 +6126,7 @@
|
| Label miss;
|
| __ mov(ecx, Operand(edx));
|
| __ and_(ecx, Operand(eax));
|
| - __ test(ecx, Immediate(kSmiTagMask));
|
| - __ j(zero, &miss, Label::kNear);
|
| + __ JumpIfSmi(ecx, &miss, Label::kNear);
|
|
|
| __ CmpObjectType(eax, JS_OBJECT_TYPE, ecx);
|
| __ j(not_equal, &miss, Label::kNear);
|
|
|