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

Unified Diff: src/ia32/codegen-ia32.cc

Issue 1533004: Inline %_ArgumentsLength. (Closed)
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codegen.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/codegen-ia32.cc
diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc
index ec384d12638400fa3bd1c96f39436ad48598966b..d07bd0f64e361b387f5436c138ecd325926b571a 100644
--- a/src/ia32/codegen-ia32.cc
+++ b/src/ia32/codegen-ia32.cc
@@ -6228,12 +6228,30 @@ void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) {
ASSERT(args->length() == 0);
- // ArgumentsAccessStub takes the parameter count as an input argument
- // in register eax. Create a constant result for it.
- Result count(Handle<Smi>(Smi::FromInt(scope()->num_parameters())));
- // Call the shared stub to get to the arguments.length.
- ArgumentsAccessStub stub(ArgumentsAccessStub::READ_LENGTH);
- Result result = frame_->CallStub(&stub, &count);
+
+ Result fp = allocator_->Allocate();
+ Result result = allocator_->Allocate();
antonm 2010/03/30 13:28:05 shouldn't you Unuse fp and result at the end of th
antonm 2010/03/30 13:28:05 just curious: any chances allocating the single re
Vitaly Repeshko 2010/03/30 13:40:30 ~Result will do it. I think it's only necessary wh
Vitaly Repeshko 2010/03/30 13:40:30 Hard to tell. I can experiment more after this cha
fschneider 2010/03/30 13:44:36 Unuse() is called by the destructor of Result at t
+ ASSERT(fp.is_valid() && result.is_valid());
+
+ Label exit;
+
+ // Get the number of formal parameters.
+ __ Set(result.reg(), Immediate(Smi::FromInt(scope()->num_parameters())));
+
+ // Check if the calling frame is an arguments adaptor frame.
+ __ mov(fp.reg(), Operand(ebp, StandardFrameConstants::kCallerFPOffset));
+ __ cmp(Operand(fp.reg(), StandardFrameConstants::kContextOffset),
+ Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
+ __ j(not_equal, &exit);
+
+ // Arguments adaptor case: Read the arguments length from the
+ // adaptor frame.
+ __ mov(result.reg(),
+ Operand(fp.reg(), ArgumentsAdaptorFrameConstants::kLengthOffset));
+
+ __ bind(&exit);
+ result.set_type_info(TypeInfo::Smi());
+ if (FLAG_debug_code) __ AbortIfNotSmi(result.reg());
antonm 2010/03/30 13:28:05 two questions. 1) why not use cmov still? 2) do w
Vitaly Repeshko 2010/03/30 13:40:30 AFAIK, cmov should be used in totally unpredictabl
frame_->Push(&result);
}
@@ -10411,30 +10429,6 @@ void GenericUnaryOpStub::Generate(MacroAssembler* masm) {
}
-void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
- // Check if the calling frame is an arguments adaptor frame.
- __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
- __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
- __ cmp(Operand(ecx), Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
-
- // Arguments adaptor case: Read the arguments length from the
- // adaptor frame and return it.
- // Otherwise nothing to do: The number of formal parameters has already been
- // passed in register eax by calling function. Just return it.
- if (CpuFeatures::IsSupported(CMOV)) {
- CpuFeatures::Scope use_cmov(CMOV);
- __ cmov(equal, eax,
- Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
- } else {
- Label exit;
- __ j(not_equal, &exit);
- __ mov(eax, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
- __ bind(&exit);
- }
- __ ret(0);
-}
-
-
void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
// The key is in edx and the parameter count is in eax.
« no previous file with comments | « src/codegen.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698