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

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

Issue 303021: Added support for array literals to the toplevel compiler. They are... (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/fast-codegen.cc ('k') | src/ia32/fast-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 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 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 node->break_target()->Unuse(); 2268 node->break_target()->Unuse();
2269 } 2269 }
2270 2270
2271 2271
2272 void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { 2272 void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
2273 // Call the runtime to declare the globals. The inevitable call 2273 // Call the runtime to declare the globals. The inevitable call
2274 // will sync frame elements to memory anyway, so we do it eagerly to 2274 // will sync frame elements to memory anyway, so we do it eagerly to
2275 // allow us to push the arguments directly into place. 2275 // allow us to push the arguments directly into place.
2276 frame_->SyncRange(0, frame_->element_count() - 1); 2276 frame_->SyncRange(0, frame_->element_count() - 1);
2277 2277
2278 frame_->EmitPush(esi); // The context is the first argument.
2278 frame_->EmitPush(Immediate(pairs)); 2279 frame_->EmitPush(Immediate(pairs));
2279 frame_->EmitPush(esi); // The context is the second argument.
2280 frame_->EmitPush(Immediate(Smi::FromInt(is_eval() ? 1 : 0))); 2280 frame_->EmitPush(Immediate(Smi::FromInt(is_eval() ? 1 : 0)));
2281 Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 3); 2281 Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 3);
2282 // Return value is ignored. 2282 // Return value is ignored.
2283 } 2283 }
2284 2284
2285 2285
2286 void CodeGenerator::VisitDeclaration(Declaration* node) { 2286 void CodeGenerator::VisitDeclaration(Declaration* node) {
2287 Comment cmnt(masm_, "[ Declaration"); 2287 Comment cmnt(masm_, "[ Declaration");
2288 Variable* var = node->proxy()->var(); 2288 Variable* var = node->proxy()->var();
2289 ASSERT(var != NULL); // must have been resolved 2289 ASSERT(var != NULL); // must have been resolved
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3569 3569
3570 3570
3571 void CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) { 3571 void CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) {
3572 // Call the runtime to instantiate the function boilerplate object. 3572 // Call the runtime to instantiate the function boilerplate object.
3573 // The inevitable call will sync frame elements to memory anyway, so 3573 // The inevitable call will sync frame elements to memory anyway, so
3574 // we do it eagerly to allow us to push the arguments directly into 3574 // we do it eagerly to allow us to push the arguments directly into
3575 // place. 3575 // place.
3576 ASSERT(boilerplate->IsBoilerplate()); 3576 ASSERT(boilerplate->IsBoilerplate());
3577 frame_->SyncRange(0, frame_->element_count() - 1); 3577 frame_->SyncRange(0, frame_->element_count() - 1);
3578 3578
3579 // Push the boilerplate on the stack.
3580 frame_->EmitPush(Immediate(boilerplate));
3581
3582 // Create a new closure. 3579 // Create a new closure.
3583 frame_->EmitPush(esi); 3580 frame_->EmitPush(esi);
3581 frame_->EmitPush(Immediate(boilerplate));
3584 Result result = frame_->CallRuntime(Runtime::kNewClosure, 2); 3582 Result result = frame_->CallRuntime(Runtime::kNewClosure, 2);
3585 frame_->Push(&result); 3583 frame_->Push(&result);
3586 } 3584 }
3587 3585
3588 3586
3589 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { 3587 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) {
3590 Comment cmnt(masm_, "[ FunctionLiteral"); 3588 Comment cmnt(masm_, "[ FunctionLiteral");
3591 3589
3592 // Build the function boilerplate and instantiate it. 3590 // Build the function boilerplate and instantiate it.
3593 Handle<JSFunction> boilerplate = BuildBoilerplate(node); 3591 Handle<JSFunction> boilerplate = BuildBoilerplate(node);
(...skipping 4488 matching lines...) Expand 10 before | Expand all | Expand 10 after
8082 8080
8083 int CompareStub::MinorKey() { 8081 int CompareStub::MinorKey() {
8084 // Encode the two parameters in a unique 16 bit value. 8082 // Encode the two parameters in a unique 16 bit value.
8085 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 8083 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
8086 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 8084 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
8087 } 8085 }
8088 8086
8089 #undef __ 8087 #undef __
8090 8088
8091 } } // namespace v8::internal 8089 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/fast-codegen.cc ('k') | src/ia32/fast-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698