| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 3411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3422 Register receiver = ToRegister(instr->receiver()); | 3422 Register receiver = ToRegister(instr->receiver()); |
| 3423 Register function = ToRegister(instr->function()); | 3423 Register function = ToRegister(instr->function()); |
| 3424 Register result = ToRegister(instr->result()); | 3424 Register result = ToRegister(instr->result()); |
| 3425 Register scratch = scratch0(); | 3425 Register scratch = scratch0(); |
| 3426 | 3426 |
| 3427 // If the receiver is null or undefined, we have to pass the global | 3427 // If the receiver is null or undefined, we have to pass the global |
| 3428 // object as a receiver to normal functions. Values have to be | 3428 // object as a receiver to normal functions. Values have to be |
| 3429 // passed unchanged to builtins and strict-mode functions. | 3429 // passed unchanged to builtins and strict-mode functions. |
| 3430 Label global_object, result_in_receiver; | 3430 Label global_object, result_in_receiver; |
| 3431 | 3431 |
| 3432 // Do not transform the receiver to object for strict mode | 3432 if (!instr->hydrogen()->known_function()) { |
| 3433 // functions. | 3433 // Do not transform the receiver to object for strict mode |
| 3434 __ ldr(scratch, | 3434 // functions. |
| 3435 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); | 3435 __ ldr(scratch, |
| 3436 __ ldr(scratch, | 3436 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 3437 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); | 3437 __ ldr(scratch, |
| 3438 __ tst(scratch, | 3438 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); |
| 3439 Operand(1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize))); | 3439 int mask = 1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize); |
| 3440 __ b(ne, &result_in_receiver); | 3440 __ tst(scratch, Operand(mask)); |
| 3441 __ b(ne, &result_in_receiver); |
| 3441 | 3442 |
| 3442 // Do not transform the receiver to object for builtins. | 3443 // Do not transform the receiver to object for builtins. |
| 3443 __ tst(scratch, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); | 3444 __ tst(scratch, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); |
| 3444 __ b(ne, &result_in_receiver); | 3445 __ b(ne, &result_in_receiver); |
| 3446 } |
| 3445 | 3447 |
| 3446 // Normal function. Replace undefined or null with global receiver. | 3448 // Normal function. Replace undefined or null with global receiver. |
| 3447 __ LoadRoot(scratch, Heap::kNullValueRootIndex); | 3449 __ LoadRoot(scratch, Heap::kNullValueRootIndex); |
| 3448 __ cmp(receiver, scratch); | 3450 __ cmp(receiver, scratch); |
| 3449 __ b(eq, &global_object); | 3451 __ b(eq, &global_object); |
| 3450 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 3452 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 3451 __ cmp(receiver, scratch); | 3453 __ cmp(receiver, scratch); |
| 3452 __ b(eq, &global_object); | 3454 __ b(eq, &global_object); |
| 3453 | 3455 |
| 3454 // Deoptimize if the receiver is not a JS object. | 3456 // Deoptimize if the receiver is not a JS object. |
| 3455 __ SmiTst(receiver); | 3457 __ SmiTst(receiver); |
| 3456 DeoptimizeIf(eq, instr->environment()); | 3458 DeoptimizeIf(eq, instr->environment()); |
| 3457 __ CompareObjectType(receiver, scratch, scratch, FIRST_SPEC_OBJECT_TYPE); | 3459 __ CompareObjectType(receiver, scratch, scratch, FIRST_SPEC_OBJECT_TYPE); |
| 3458 DeoptimizeIf(lt, instr->environment()); | 3460 DeoptimizeIf(lt, instr->environment()); |
| 3461 |
| 3459 __ b(&result_in_receiver); | 3462 __ b(&result_in_receiver); |
| 3460 | |
| 3461 __ bind(&global_object); | 3463 __ bind(&global_object); |
| 3462 __ ldr(result, FieldMemOperand(function, JSFunction::kContextOffset)); | 3464 __ ldr(result, FieldMemOperand(function, JSFunction::kContextOffset)); |
| 3463 __ ldr(result, | 3465 __ ldr(result, |
| 3464 ContextOperand(result, Context::GLOBAL_OBJECT_INDEX)); | 3466 ContextOperand(result, Context::GLOBAL_OBJECT_INDEX)); |
| 3465 __ ldr(result, | 3467 __ ldr(result, |
| 3466 FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset)); | 3468 FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset)); |
| 3467 | 3469 |
| 3468 if (result.is(receiver)) { | 3470 if (result.is(receiver)) { |
| 3469 __ bind(&result_in_receiver); | 3471 __ bind(&result_in_receiver); |
| 3470 } else { | 3472 } else { |
| (...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5743 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5745 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5744 __ ldr(result, FieldMemOperand(scratch, | 5746 __ ldr(result, FieldMemOperand(scratch, |
| 5745 FixedArray::kHeaderSize - kPointerSize)); | 5747 FixedArray::kHeaderSize - kPointerSize)); |
| 5746 __ bind(&done); | 5748 __ bind(&done); |
| 5747 } | 5749 } |
| 5748 | 5750 |
| 5749 | 5751 |
| 5750 #undef __ | 5752 #undef __ |
| 5751 | 5753 |
| 5752 } } // namespace v8::internal | 5754 } } // namespace v8::internal |
| OLD | NEW |