MIPS: Optimize HWrapReceiver.

Port r18945 (699b03e)

BUG=
R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/145083018

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18960 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
plind44@gmail.com 2014-01-30 18:13:38 +00:00
parent 51107bad1c
commit ad53abec73
2 changed files with 16 additions and 13 deletions

View File

@ -3304,19 +3304,21 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
// passed unchanged to builtins and strict-mode functions.
Label global_object, result_in_receiver;
// Do not transform the receiver to object for strict mode
// functions.
__ lw(scratch,
FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
__ lw(scratch,
FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
if (!instr->hydrogen()->known_function()) {
// Do not transform the receiver to object for strict mode
// functions.
__ lw(scratch,
FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
__ lw(scratch,
FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
// Do not transform the receiver to object for builtins.
int32_t strict_mode_function_mask =
1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize);
int32_t native_mask = 1 << (SharedFunctionInfo::kNative + kSmiTagSize);
__ And(scratch, scratch, Operand(strict_mode_function_mask | native_mask));
__ Branch(&result_in_receiver, ne, scratch, Operand(zero_reg));
// Do not transform the receiver to object for builtins.
int32_t strict_mode_function_mask =
1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize);
int32_t native_mask = 1 << (SharedFunctionInfo::kNative + kSmiTagSize);
__ And(scratch, scratch, Operand(strict_mode_function_mask | native_mask));
__ Branch(&result_in_receiver, ne, scratch, Operand(zero_reg));
}
// Normal function. Replace undefined or null with global receiver.
__ LoadRoot(scratch, Heap::kNullValueRootIndex);
@ -3331,8 +3333,8 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
__ GetObjectType(receiver, scratch, scratch);
DeoptimizeIf(lt, instr->environment(),
scratch, Operand(FIRST_SPEC_OBJECT_TYPE));
__ Branch(&result_in_receiver);
__ Branch(&result_in_receiver);
__ bind(&global_object);
__ lw(result, FieldMemOperand(function, JSFunction::kContextOffset));
__ lw(result,

View File

@ -548,6 +548,7 @@ class LWrapReceiver V8_FINAL : public LTemplateInstruction<1, 2, 0> {
}
DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
DECLARE_HYDROGEN_ACCESSOR(WrapReceiver)
LOperand* receiver() { return inputs_[0]; }
LOperand* function() { return inputs_[1]; }