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

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

Issue 7096006: Update apply with arguments optimization for strict mode functions and builtins. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments. Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/x64/builtins-x64.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2584 matching lines...) Expand 10 before | Expand all | Expand 10 after
2595 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { 2595 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2596 Register receiver = ToRegister(instr->receiver()); 2596 Register receiver = ToRegister(instr->receiver());
2597 Register function = ToRegister(instr->function()); 2597 Register function = ToRegister(instr->function());
2598 Register length = ToRegister(instr->length()); 2598 Register length = ToRegister(instr->length());
2599 Register elements = ToRegister(instr->elements()); 2599 Register elements = ToRegister(instr->elements());
2600 Register scratch = ToRegister(instr->TempAt(0)); 2600 Register scratch = ToRegister(instr->TempAt(0));
2601 ASSERT(receiver.is(eax)); // Used for parameter count. 2601 ASSERT(receiver.is(eax)); // Used for parameter count.
2602 ASSERT(function.is(edi)); // Required by InvokeFunction. 2602 ASSERT(function.is(edi)); // Required by InvokeFunction.
2603 ASSERT(ToRegister(instr->result()).is(eax)); 2603 ASSERT(ToRegister(instr->result()).is(eax));
2604 2604
2605 // TODO(1412): This is not correct if the called function is a 2605 // If the receiver is null or undefined, we have to pass the global
2606 // strict mode function or a native. 2606 // object as a receiver to normal functions. Values have to be
2607 // 2607 // passed unchanged to builtins and strict-mode functions.
2608 // If the receiver is null or undefined, we have to pass the global object
2609 // as a receiver.
2610 Label global_object, receiver_ok; 2608 Label global_object, receiver_ok;
2609
2610 // Do not transform the receiver to object for strict mode
2611 // functions.
2612 __ mov(scratch,
2613 FieldOperand(function, JSFunction::kSharedFunctionInfoOffset));
2614 __ test_b(FieldOperand(scratch, SharedFunctionInfo::kStrictModeByteOffset),
2615 1 << SharedFunctionInfo::kStrictModeBitWithinByte);
2616 __ j(not_equal, &receiver_ok, Label::kNear);
2617
2618 // Do not transform the receiver to object for builtins.
2619 __ test_b(FieldOperand(scratch, SharedFunctionInfo::kNativeByteOffset),
2620 1 << SharedFunctionInfo::kNativeBitWithinByte);
2621 __ j(not_equal, &receiver_ok, Label::kNear);
2622
2623 // Normal function. Replace undefined or null with global receiver.
2611 __ cmp(receiver, factory()->null_value()); 2624 __ cmp(receiver, factory()->null_value());
2612 __ j(equal, &global_object, Label::kNear); 2625 __ j(equal, &global_object, Label::kNear);
2613 __ cmp(receiver, factory()->undefined_value()); 2626 __ cmp(receiver, factory()->undefined_value());
2614 __ j(equal, &global_object, Label::kNear); 2627 __ j(equal, &global_object, Label::kNear);
2615 2628
2616 // The receiver should be a JS object. 2629 // The receiver should be a JS object.
2617 __ test(receiver, Immediate(kSmiTagMask)); 2630 __ test(receiver, Immediate(kSmiTagMask));
2618 DeoptimizeIf(equal, instr->environment()); 2631 DeoptimizeIf(equal, instr->environment());
2619 __ CmpObjectType(receiver, FIRST_JS_OBJECT_TYPE, scratch); 2632 __ CmpObjectType(receiver, FIRST_JS_OBJECT_TYPE, scratch);
2620 DeoptimizeIf(below, instr->environment()); 2633 DeoptimizeIf(below, instr->environment());
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 4467 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
4455 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4468 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4456 } 4469 }
4457 4470
4458 4471
4459 #undef __ 4472 #undef __
4460 4473
4461 } } // namespace v8::internal 4474 } } // namespace v8::internal
4462 4475
4463 #endif // V8_TARGET_ARCH_IA32 4476 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698