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

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

Issue 3136032: Simplify the way constructors are called and avoid pushing... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 4 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/ia32/builtins-ia32.cc ('k') | src/ia32/full-codegen-ia32.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 6372 matching lines...) Expand 10 before | Expand all | Expand 10 after
6383 void CodeGenerator::VisitCallNew(CallNew* node) { 6383 void CodeGenerator::VisitCallNew(CallNew* node) {
6384 ASSERT(!in_safe_int32_mode()); 6384 ASSERT(!in_safe_int32_mode());
6385 Comment cmnt(masm_, "[ CallNew"); 6385 Comment cmnt(masm_, "[ CallNew");
6386 6386
6387 // According to ECMA-262, section 11.2.2, page 44, the function 6387 // According to ECMA-262, section 11.2.2, page 44, the function
6388 // expression in new calls must be evaluated before the 6388 // expression in new calls must be evaluated before the
6389 // arguments. This is different from ordinary calls, where the 6389 // arguments. This is different from ordinary calls, where the
6390 // actual function to call is resolved after the arguments have been 6390 // actual function to call is resolved after the arguments have been
6391 // evaluated. 6391 // evaluated.
6392 6392
6393 // Compute function to call and use the global object as the 6393 // Push constructor on the stack. If it's not a function it's used as
6394 // receiver. There is no need to use the global proxy here because 6394 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is
6395 // it will always be replaced with a newly allocated object. 6395 // ignored.
6396 Load(node->expression()); 6396 Load(node->expression());
6397 LoadGlobal();
6398 6397
6399 // Push the arguments ("left-to-right") on the stack. 6398 // Push the arguments ("left-to-right") on the stack.
6400 ZoneList<Expression*>* args = node->arguments(); 6399 ZoneList<Expression*>* args = node->arguments();
6401 int arg_count = args->length(); 6400 int arg_count = args->length();
6402 for (int i = 0; i < arg_count; i++) { 6401 for (int i = 0; i < arg_count; i++) {
6403 Load(args->at(i)); 6402 Load(args->at(i));
6404 } 6403 }
6405 6404
6406 // Call the construct call builtin that handles allocation and 6405 // Call the construct call builtin that handles allocation and
6407 // constructor invocation. 6406 // constructor invocation.
6408 CodeForSourcePosition(node->position()); 6407 CodeForSourcePosition(node->position());
6409 Result result = frame_->CallConstructor(arg_count); 6408 Result result = frame_->CallConstructor(arg_count);
6410 // Replace the function on the stack with the result. 6409 frame_->Push(&result);
6411 frame_->SetElementAt(0, &result);
6412 } 6410 }
6413 6411
6414 6412
6415 void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) { 6413 void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) {
6416 ASSERT(args->length() == 1); 6414 ASSERT(args->length() == 1);
6417 Load(args->at(0)); 6415 Load(args->at(0));
6418 Result value = frame_->Pop(); 6416 Result value = frame_->Pop();
6419 value.ToRegister(); 6417 value.ToRegister();
6420 ASSERT(value.is_valid()); 6418 ASSERT(value.is_valid());
6421 __ test(value.reg(), Immediate(kSmiTagMask)); 6419 __ test(value.reg(), Immediate(kSmiTagMask));
(...skipping 8082 matching lines...) Expand 10 before | Expand all | Expand 10 after
14504 masm.GetCode(&desc); 14502 masm.GetCode(&desc);
14505 // Call the function from C++. 14503 // Call the function from C++.
14506 return FUNCTION_CAST<MemCopyFunction>(buffer); 14504 return FUNCTION_CAST<MemCopyFunction>(buffer);
14507 } 14505 }
14508 14506
14509 #undef __ 14507 #undef __
14510 14508
14511 } } // namespace v8::internal 14509 } } // namespace v8::internal
14512 14510
14513 #endif // V8_TARGET_ARCH_IA32 14511 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698