| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" | 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
| (...skipping 3442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3453 Register result = ToRegister(instr->result()); | 3453 Register result = ToRegister(instr->result()); |
| 3454 Register scratch = scratch0(); | 3454 Register scratch = scratch0(); |
| 3455 | 3455 |
| 3456 // If the receiver is null or undefined, we have to pass the global | 3456 // If the receiver is null or undefined, we have to pass the global |
| 3457 // object as a receiver to normal functions. Values have to be | 3457 // object as a receiver to normal functions. Values have to be |
| 3458 // passed unchanged to builtins and strict-mode functions. | 3458 // passed unchanged to builtins and strict-mode functions. |
| 3459 Label global_object, result_in_receiver; | 3459 Label global_object, result_in_receiver; |
| 3460 | 3460 |
| 3461 if (!instr->hydrogen()->known_function()) { | 3461 if (!instr->hydrogen()->known_function()) { |
| 3462 // Do not transform the receiver to object for strict mode | 3462 // Do not transform the receiver to object for strict mode |
| 3463 // functions. | 3463 // functions or builtins. |
| 3464 __ LoadP(scratch, | 3464 __ LoadP(scratch, |
| 3465 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); | 3465 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 3466 __ lwz(scratch, | 3466 __ lwz(scratch, |
| 3467 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); | 3467 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); |
| 3468 __ TestBit(scratch, | 3468 __ andi(r0, scratch, Operand((1 << SharedFunctionInfo::kStrictModeBit) | |
| 3469 #if V8_TARGET_ARCH_PPC64 | 3469 (1 << SharedFunctionInfo::kNativeBit))); |
| 3470 SharedFunctionInfo::kStrictModeFunction, | |
| 3471 #else | |
| 3472 SharedFunctionInfo::kStrictModeFunction + kSmiTagSize, | |
| 3473 #endif | |
| 3474 r0); | |
| 3475 __ bne(&result_in_receiver, cr0); | |
| 3476 | |
| 3477 // Do not transform the receiver to object for builtins. | |
| 3478 __ TestBit(scratch, | |
| 3479 #if V8_TARGET_ARCH_PPC64 | |
| 3480 SharedFunctionInfo::kNative, | |
| 3481 #else | |
| 3482 SharedFunctionInfo::kNative + kSmiTagSize, | |
| 3483 #endif | |
| 3484 r0); | |
| 3485 __ bne(&result_in_receiver, cr0); | 3470 __ bne(&result_in_receiver, cr0); |
| 3486 } | 3471 } |
| 3487 | 3472 |
| 3488 // Normal function. Replace undefined or null with global receiver. | 3473 // Normal function. Replace undefined or null with global receiver. |
| 3489 __ LoadRoot(scratch, Heap::kNullValueRootIndex); | 3474 __ LoadRoot(scratch, Heap::kNullValueRootIndex); |
| 3490 __ cmp(receiver, scratch); | 3475 __ cmp(receiver, scratch); |
| 3491 __ beq(&global_object); | 3476 __ beq(&global_object); |
| 3492 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 3477 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 3493 __ cmp(receiver, scratch); | 3478 __ cmp(receiver, scratch); |
| 3494 __ beq(&global_object); | 3479 __ beq(&global_object); |
| (...skipping 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6080 __ Push(scope_info); | 6065 __ Push(scope_info); |
| 6081 __ push(ToRegister(instr->function())); | 6066 __ push(ToRegister(instr->function())); |
| 6082 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6067 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6083 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6068 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6084 } | 6069 } |
| 6085 | 6070 |
| 6086 | 6071 |
| 6087 #undef __ | 6072 #undef __ |
| 6088 } // namespace internal | 6073 } // namespace internal |
| 6089 } // namespace v8 | 6074 } // namespace v8 |
| OLD | NEW |