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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 149266: Port IsConstructCall optimization to x64 and ARM. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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/codegen-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 3217 matching lines...) Expand 10 before | Expand all | Expand 10 after
3228 destination()->false_target()->Branch(equal); 3228 destination()->false_target()->Branch(equal);
3229 // It is a heap object - get map. 3229 // It is a heap object - get map.
3230 // Check if the object is a JS array or not. 3230 // Check if the object is a JS array or not.
3231 __ CmpObjectType(value.reg(), JS_ARRAY_TYPE, kScratchRegister); 3231 __ CmpObjectType(value.reg(), JS_ARRAY_TYPE, kScratchRegister);
3232 value.Unuse(); 3232 value.Unuse();
3233 destination()->Split(equal); 3233 destination()->Split(equal);
3234 } 3234 }
3235 3235
3236 3236
3237 void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) { 3237 void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
3238 // TODO(X64): Optimize this like it's done on IA-32.
3239 ASSERT(args->length() == 0); 3238 ASSERT(args->length() == 0);
3240 Result answer = frame_->CallRuntime(Runtime::kIsConstructCall, 0); 3239
3241 frame_->Push(&answer); 3240 // Get the frame pointer for the calling frame.
3241 Result fp = allocator()->Allocate();
3242 __ movq(fp.reg(), Operand(rbp, StandardFrameConstants::kCallerFPOffset));
3243
3244 // Skip the arguments adaptor frame if it exists.
3245 Label check_frame_marker;
3246 __ cmpq(Operand(fp.reg(), StandardFrameConstants::kContextOffset),
3247 Immediate(ArgumentsAdaptorFrame::SENTINEL));
3248 __ j(not_equal, &check_frame_marker);
3249 __ movq(fp.reg(), Operand(fp.reg(), StandardFrameConstants::kCallerFPOffset));
3250
3251 // Check the marker in the calling frame.
3252 __ bind(&check_frame_marker);
3253 __ cmpq(Operand(fp.reg(), StandardFrameConstants::kMarkerOffset),
3254 Immediate(Smi::FromInt(StackFrame::CONSTRUCT)));
3255 fp.Unuse();
3256 destination()->Split(equal);
3242 } 3257 }
3243 3258
3244 3259
3245 void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) { 3260 void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) {
3246 ASSERT(args->length() == 0); 3261 ASSERT(args->length() == 0);
3247 // ArgumentsAccessStub takes the parameter count as an input argument 3262 // ArgumentsAccessStub takes the parameter count as an input argument
3248 // in register eax. Create a constant result for it. 3263 // in register eax. Create a constant result for it.
3249 Result count(Handle<Smi>(Smi::FromInt(scope_->num_parameters()))); 3264 Result count(Handle<Smi>(Smi::FromInt(scope_->num_parameters())));
3250 // Call the shared stub to get to the arguments.length. 3265 // Call the shared stub to get to the arguments.length.
3251 ArgumentsAccessStub stub(ArgumentsAccessStub::READ_LENGTH); 3266 ArgumentsAccessStub stub(ArgumentsAccessStub::READ_LENGTH);
(...skipping 3680 matching lines...) Expand 10 before | Expand all | Expand 10 after
6932 int CompareStub::MinorKey() { 6947 int CompareStub::MinorKey() {
6933 // Encode the two parameters in a unique 16 bit value. 6948 // Encode the two parameters in a unique 16 bit value.
6934 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 6949 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
6935 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 6950 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
6936 } 6951 }
6937 6952
6938 6953
6939 #undef __ 6954 #undef __
6940 6955
6941 } } // namespace v8::internal 6956 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698