Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 145083018: MIPS: Optimize HWrapReceiver. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/mips/lithium-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
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 3286 matching lines...) Expand 10 before | Expand all | Expand 10 after
3297 Register receiver = ToRegister(instr->receiver()); 3297 Register receiver = ToRegister(instr->receiver());
3298 Register function = ToRegister(instr->function()); 3298 Register function = ToRegister(instr->function());
3299 Register result = ToRegister(instr->result()); 3299 Register result = ToRegister(instr->result());
3300 Register scratch = scratch0(); 3300 Register scratch = scratch0();
3301 3301
3302 // If the receiver is null or undefined, we have to pass the global 3302 // If the receiver is null or undefined, we have to pass the global
3303 // object as a receiver to normal functions. Values have to be 3303 // object as a receiver to normal functions. Values have to be
3304 // passed unchanged to builtins and strict-mode functions. 3304 // passed unchanged to builtins and strict-mode functions.
3305 Label global_object, result_in_receiver; 3305 Label global_object, result_in_receiver;
3306 3306
3307 // Do not transform the receiver to object for strict mode 3307 if (!instr->hydrogen()->known_function()) {
3308 // functions. 3308 // Do not transform the receiver to object for strict mode
3309 __ lw(scratch, 3309 // functions.
3310 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); 3310 __ lw(scratch,
3311 __ lw(scratch, 3311 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
3312 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); 3312 __ lw(scratch,
3313 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
3313 3314
3314 // Do not transform the receiver to object for builtins. 3315 // Do not transform the receiver to object for builtins.
3315 int32_t strict_mode_function_mask = 3316 int32_t strict_mode_function_mask =
3316 1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize); 3317 1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize);
3317 int32_t native_mask = 1 << (SharedFunctionInfo::kNative + kSmiTagSize); 3318 int32_t native_mask = 1 << (SharedFunctionInfo::kNative + kSmiTagSize);
3318 __ And(scratch, scratch, Operand(strict_mode_function_mask | native_mask)); 3319 __ And(scratch, scratch, Operand(strict_mode_function_mask | native_mask));
3319 __ Branch(&result_in_receiver, ne, scratch, Operand(zero_reg)); 3320 __ Branch(&result_in_receiver, ne, scratch, Operand(zero_reg));
3321 }
3320 3322
3321 // Normal function. Replace undefined or null with global receiver. 3323 // Normal function. Replace undefined or null with global receiver.
3322 __ LoadRoot(scratch, Heap::kNullValueRootIndex); 3324 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
3323 __ Branch(&global_object, eq, receiver, Operand(scratch)); 3325 __ Branch(&global_object, eq, receiver, Operand(scratch));
3324 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 3326 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
3325 __ Branch(&global_object, eq, receiver, Operand(scratch)); 3327 __ Branch(&global_object, eq, receiver, Operand(scratch));
3326 3328
3327 // Deoptimize if the receiver is not a JS object. 3329 // Deoptimize if the receiver is not a JS object.
3328 __ SmiTst(receiver, scratch); 3330 __ SmiTst(receiver, scratch);
3329 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); 3331 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg));
3330 3332
3331 __ GetObjectType(receiver, scratch, scratch); 3333 __ GetObjectType(receiver, scratch, scratch);
3332 DeoptimizeIf(lt, instr->environment(), 3334 DeoptimizeIf(lt, instr->environment(),
3333 scratch, Operand(FIRST_SPEC_OBJECT_TYPE)); 3335 scratch, Operand(FIRST_SPEC_OBJECT_TYPE));
3336
3334 __ Branch(&result_in_receiver); 3337 __ Branch(&result_in_receiver);
3335
3336 __ bind(&global_object); 3338 __ bind(&global_object);
3337 __ lw(result, FieldMemOperand(function, JSFunction::kContextOffset)); 3339 __ lw(result, FieldMemOperand(function, JSFunction::kContextOffset));
3338 __ lw(result, 3340 __ lw(result,
3339 ContextOperand(result, Context::GLOBAL_OBJECT_INDEX)); 3341 ContextOperand(result, Context::GLOBAL_OBJECT_INDEX));
3340 __ lw(result, 3342 __ lw(result,
3341 FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset)); 3343 FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset));
3342 3344
3343 if (result.is(receiver)) { 3345 if (result.is(receiver)) {
3344 __ bind(&result_in_receiver); 3346 __ bind(&result_in_receiver);
3345 } else { 3347 } else {
(...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after
5734 __ Subu(scratch, result, scratch); 5736 __ Subu(scratch, result, scratch);
5735 __ lw(result, FieldMemOperand(scratch, 5737 __ lw(result, FieldMemOperand(scratch,
5736 FixedArray::kHeaderSize - kPointerSize)); 5738 FixedArray::kHeaderSize - kPointerSize));
5737 __ bind(&done); 5739 __ bind(&done);
5738 } 5740 }
5739 5741
5740 5742
5741 #undef __ 5743 #undef __
5742 5744
5743 } } // namespace v8::internal 5745 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mips/lithium-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698