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

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

Issue 9643001: Inline functions that use arguments object in f.apply(o, arguments) pattern. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: regression test Created 8 years, 9 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
OLDNEW
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 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 2580 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
2581 __ mov(result, Operand(result, 2581 __ mov(result, Operand(result,
2582 ArgumentsAdaptorFrameConstants::kLengthOffset)); 2582 ArgumentsAdaptorFrameConstants::kLengthOffset));
2583 __ SmiUntag(result); 2583 __ SmiUntag(result);
2584 2584
2585 // Argument length is in result register. 2585 // Argument length is in result register.
2586 __ bind(&done); 2586 __ bind(&done);
2587 } 2587 }
2588 2588
2589 2589
2590 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { 2590 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
2591 Register receiver = ToRegister(instr->receiver()); 2591 Register receiver = ToRegister(instr->receiver());
2592 Register function = ToRegister(instr->function()); 2592 Register function = ToRegister(instr->function());
2593 Register length = ToRegister(instr->length());
2594 Register elements = ToRegister(instr->elements());
2595 Register scratch = ToRegister(instr->TempAt(0)); 2593 Register scratch = ToRegister(instr->TempAt(0));
2596 ASSERT(receiver.is(eax)); // Used for parameter count.
2597 ASSERT(function.is(edi)); // Required by InvokeFunction.
2598 ASSERT(ToRegister(instr->result()).is(eax));
2599 2594
2600 // If the receiver is null or undefined, we have to pass the global 2595 // If the receiver is null or undefined, we have to pass the global
2601 // object as a receiver to normal functions. Values have to be 2596 // object as a receiver to normal functions. Values have to be
2602 // passed unchanged to builtins and strict-mode functions. 2597 // passed unchanged to builtins and strict-mode functions.
2603 Label global_object, receiver_ok; 2598 Label global_object, receiver_ok;
2604 2599
2605 // Do not transform the receiver to object for strict mode 2600 // Do not transform the receiver to object for strict mode
2606 // functions. 2601 // functions.
2607 __ mov(scratch, 2602 __ mov(scratch,
2608 FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); 2603 FieldOperand(function, JSFunction::kSharedFunctionInfoOffset));
(...skipping 21 matching lines...) Expand all
2630 2625
2631 __ bind(&global_object); 2626 __ bind(&global_object);
2632 // TODO(kmillikin): We have a hydrogen value for the global object. See 2627 // TODO(kmillikin): We have a hydrogen value for the global object. See
2633 // if it's better to use it than to explicitly fetch it from the context 2628 // if it's better to use it than to explicitly fetch it from the context
2634 // here. 2629 // here.
2635 __ mov(receiver, Operand(ebp, StandardFrameConstants::kContextOffset)); 2630 __ mov(receiver, Operand(ebp, StandardFrameConstants::kContextOffset));
2636 __ mov(receiver, ContextOperand(receiver, Context::GLOBAL_INDEX)); 2631 __ mov(receiver, ContextOperand(receiver, Context::GLOBAL_INDEX));
2637 __ mov(receiver, 2632 __ mov(receiver,
2638 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); 2633 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset));
2639 __ bind(&receiver_ok); 2634 __ bind(&receiver_ok);
2635 }
2636
2637
2638 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2639 Register receiver = ToRegister(instr->receiver());
2640 Register function = ToRegister(instr->function());
2641 Register length = ToRegister(instr->length());
2642 Register elements = ToRegister(instr->elements());
2643 ASSERT(receiver.is(eax)); // Used for parameter count.
2644 ASSERT(function.is(edi)); // Required by InvokeFunction.
2645 ASSERT(ToRegister(instr->result()).is(eax));
2640 2646
2641 // Copy the arguments to this function possibly from the 2647 // Copy the arguments to this function possibly from the
2642 // adaptor frame below it. 2648 // adaptor frame below it.
2643 const uint32_t kArgumentsLimit = 1 * KB; 2649 const uint32_t kArgumentsLimit = 1 * KB;
2644 __ cmp(length, kArgumentsLimit); 2650 __ cmp(length, kArgumentsLimit);
2645 DeoptimizeIf(above, instr->environment()); 2651 DeoptimizeIf(above, instr->environment());
2646 2652
2647 __ push(receiver); 2653 __ push(receiver);
2648 __ mov(receiver, length); 2654 __ mov(receiver, length);
2649 2655
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after
4957 FixedArray::kHeaderSize - kPointerSize)); 4963 FixedArray::kHeaderSize - kPointerSize));
4958 __ bind(&done); 4964 __ bind(&done);
4959 } 4965 }
4960 4966
4961 4967
4962 #undef __ 4968 #undef __
4963 4969
4964 } } // namespace v8::internal 4970 } } // namespace v8::internal
4965 4971
4966 #endif // V8_TARGET_ARCH_IA32 4972 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698