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

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

Issue 246019: Move the per-ast-node statement position to only statement node types.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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/codegen-ia32.h ('k') | src/x64/codegen-x64.h » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2298 frame_->EmitPush(Immediate(pairs)); 2298 frame_->EmitPush(Immediate(pairs));
2299 frame_->EmitPush(esi); // The context is the second argument. 2299 frame_->EmitPush(esi); // The context is the second argument.
2300 frame_->EmitPush(Immediate(Smi::FromInt(is_eval() ? 1 : 0))); 2300 frame_->EmitPush(Immediate(Smi::FromInt(is_eval() ? 1 : 0)));
2301 Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 3); 2301 Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 3);
2302 // Return value is ignored. 2302 // Return value is ignored.
2303 } 2303 }
2304 2304
2305 2305
2306 void CodeGenerator::VisitDeclaration(Declaration* node) { 2306 void CodeGenerator::VisitDeclaration(Declaration* node) {
2307 Comment cmnt(masm_, "[ Declaration"); 2307 Comment cmnt(masm_, "[ Declaration");
2308 CodeForStatementPosition(node);
2309 Variable* var = node->proxy()->var(); 2308 Variable* var = node->proxy()->var();
2310 ASSERT(var != NULL); // must have been resolved 2309 ASSERT(var != NULL); // must have been resolved
2311 Slot* slot = var->slot(); 2310 Slot* slot = var->slot();
2312 2311
2313 // If it was not possible to allocate the variable at compile time, 2312 // If it was not possible to allocate the variable at compile time,
2314 // we need to "declare" it at runtime to make sure it actually 2313 // we need to "declare" it at runtime to make sure it actually
2315 // exists in the local context. 2314 // exists in the local context.
2316 if (slot != NULL && slot->type() == Slot::LOOKUP) { 2315 if (slot != NULL && slot->type() == Slot::LOOKUP) {
2317 // Variables with a "LOOKUP" slot were introduced as non-locals 2316 // Variables with a "LOOKUP" slot were introduced as non-locals
2318 // during variable resolution and must have mode DYNAMIC. 2317 // during variable resolution and must have mode DYNAMIC.
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after
4326 Load(node->key()); 4325 Load(node->key());
4327 Load(node->value()); 4326 Load(node->value());
4328 Result result = 4327 Result result =
4329 frame_->CallRuntime(Runtime::kCreateCatchExtensionObject, 2); 4328 frame_->CallRuntime(Runtime::kCreateCatchExtensionObject, 2);
4330 frame_->Push(&result); 4329 frame_->Push(&result);
4331 } 4330 }
4332 4331
4333 4332
4334 void CodeGenerator::VisitAssignment(Assignment* node) { 4333 void CodeGenerator::VisitAssignment(Assignment* node) {
4335 Comment cmnt(masm_, "[ Assignment"); 4334 Comment cmnt(masm_, "[ Assignment");
4336 CodeForStatementPosition(node);
4337 4335
4338 { Reference target(this, node->target()); 4336 { Reference target(this, node->target());
4339 if (target.is_illegal()) { 4337 if (target.is_illegal()) {
4340 // Fool the virtual frame into thinking that we left the assignment's 4338 // Fool the virtual frame into thinking that we left the assignment's
4341 // value on the frame. 4339 // value on the frame.
4342 frame_->Push(Smi::FromInt(0)); 4340 frame_->Push(Smi::FromInt(0));
4343 return; 4341 return;
4344 } 4342 }
4345 Variable* var = node->target()->AsVariableProxy()->AsVariable(); 4343 Variable* var = node->target()->AsVariableProxy()->AsVariable();
4346 4344
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
4408 frame_->PushElementAt(target.size()); 4406 frame_->PushElementAt(target.size());
4409 Result ignored = frame_->CallRuntime(Runtime::kToFastProperties, 1); 4407 Result ignored = frame_->CallRuntime(Runtime::kToFastProperties, 1);
4410 } 4408 }
4411 } 4409 }
4412 } 4410 }
4413 } 4411 }
4414 4412
4415 4413
4416 void CodeGenerator::VisitThrow(Throw* node) { 4414 void CodeGenerator::VisitThrow(Throw* node) {
4417 Comment cmnt(masm_, "[ Throw"); 4415 Comment cmnt(masm_, "[ Throw");
4418 CodeForStatementPosition(node);
4419
4420 Load(node->exception()); 4416 Load(node->exception());
4421 Result result = frame_->CallRuntime(Runtime::kThrow, 1); 4417 Result result = frame_->CallRuntime(Runtime::kThrow, 1);
4422 frame_->Push(&result); 4418 frame_->Push(&result);
4423 } 4419 }
4424 4420
4425 4421
4426 void CodeGenerator::VisitProperty(Property* node) { 4422 void CodeGenerator::VisitProperty(Property* node) {
4427 Comment cmnt(masm_, "[ Property"); 4423 Comment cmnt(masm_, "[ Property");
4428 Reference property(this, node); 4424 Reference property(this, node);
4429 property.GetValue(typeof_state()); 4425 property.GetValue(typeof_state());
4430 } 4426 }
4431 4427
4432 4428
4433 void CodeGenerator::VisitCall(Call* node) { 4429 void CodeGenerator::VisitCall(Call* node) {
4434 Comment cmnt(masm_, "[ Call"); 4430 Comment cmnt(masm_, "[ Call");
4435 4431
4436 ZoneList<Expression*>* args = node->arguments(); 4432 ZoneList<Expression*>* args = node->arguments();
4437 4433
4438 CodeForStatementPosition(node);
4439
4440 // Check if the function is a variable or a property. 4434 // Check if the function is a variable or a property.
4441 Expression* function = node->expression(); 4435 Expression* function = node->expression();
4442 Variable* var = function->AsVariableProxy()->AsVariable(); 4436 Variable* var = function->AsVariableProxy()->AsVariable();
4443 Property* property = function->AsProperty(); 4437 Property* property = function->AsProperty();
4444 4438
4445 // ------------------------------------------------------------------------ 4439 // ------------------------------------------------------------------------
4446 // Fast-case: Use inline caching. 4440 // Fast-case: Use inline caching.
4447 // --- 4441 // ---
4448 // According to ECMA-262, section 11.2.3, page 44, the function to call 4442 // According to ECMA-262, section 11.2.3, page 44, the function to call
4449 // must be resolved after the arguments have been evaluated. The IC code 4443 // must be resolved after the arguments have been evaluated. The IC code
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
4584 LoadGlobalReceiver(); 4578 LoadGlobalReceiver();
4585 4579
4586 // Call the function. 4580 // Call the function.
4587 CallWithArguments(args, node->position()); 4581 CallWithArguments(args, node->position());
4588 } 4582 }
4589 } 4583 }
4590 4584
4591 4585
4592 void CodeGenerator::VisitCallNew(CallNew* node) { 4586 void CodeGenerator::VisitCallNew(CallNew* node) {
4593 Comment cmnt(masm_, "[ CallNew"); 4587 Comment cmnt(masm_, "[ CallNew");
4594 CodeForStatementPosition(node);
4595 4588
4596 // According to ECMA-262, section 11.2.2, page 44, the function 4589 // According to ECMA-262, section 11.2.2, page 44, the function
4597 // expression in new calls must be evaluated before the 4590 // expression in new calls must be evaluated before the
4598 // arguments. This is different from ordinary calls, where the 4591 // arguments. This is different from ordinary calls, where the
4599 // actual function to call is resolved after the arguments have been 4592 // actual function to call is resolved after the arguments have been
4600 // evaluated. 4593 // evaluated.
4601 4594
4602 // Compute function to call and use the global object as the 4595 // Compute function to call and use the global object as the
4603 // receiver. There is no need to use the global proxy here because 4596 // receiver. There is no need to use the global proxy here because
4604 // it will always be replaced with a newly allocated object. 4597 // it will always be replaced with a newly allocated object.
(...skipping 19 matching lines...) Expand all
4624 void CodeGenerator::VisitCallEval(CallEval* node) { 4617 void CodeGenerator::VisitCallEval(CallEval* node) {
4625 Comment cmnt(masm_, "[ CallEval"); 4618 Comment cmnt(masm_, "[ CallEval");
4626 4619
4627 // In a call to eval, we first call %ResolvePossiblyDirectEval to resolve 4620 // In a call to eval, we first call %ResolvePossiblyDirectEval to resolve
4628 // the function we need to call and the receiver of the call. 4621 // the function we need to call and the receiver of the call.
4629 // Then we call the resolved function using the given arguments. 4622 // Then we call the resolved function using the given arguments.
4630 4623
4631 ZoneList<Expression*>* args = node->arguments(); 4624 ZoneList<Expression*>* args = node->arguments();
4632 Expression* function = node->expression(); 4625 Expression* function = node->expression();
4633 4626
4634 CodeForStatementPosition(node);
4635
4636 // Prepare the stack for the call to the resolved function. 4627 // Prepare the stack for the call to the resolved function.
4637 Load(function); 4628 Load(function);
4638 4629
4639 // Allocate a frame slot for the receiver. 4630 // Allocate a frame slot for the receiver.
4640 frame_->Push(Factory::undefined_value()); 4631 frame_->Push(Factory::undefined_value());
4641 int arg_count = args->length(); 4632 int arg_count = args->length();
4642 for (int i = 0; i < arg_count; i++) { 4633 for (int i = 0; i < arg_count; i++) {
4643 Load(args->at(i)); 4634 Load(args->at(i));
4644 } 4635 }
4645 4636
(...skipping 3333 matching lines...) Expand 10 before | Expand all | Expand 10 after
7979 7970
7980 int CompareStub::MinorKey() { 7971 int CompareStub::MinorKey() {
7981 // Encode the two parameters in a unique 16 bit value. 7972 // Encode the two parameters in a unique 16 bit value.
7982 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7973 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7983 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7974 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7984 } 7975 }
7985 7976
7986 #undef __ 7977 #undef __
7987 7978
7988 } } // namespace v8::internal 7979 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/x64/codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698