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

Side by Side Diff: src/x64/codegen-x64.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/runtime.cc ('k') | src/x64/fast-codegen-x64.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 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 263 }
264 264
265 265
266 void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { 266 void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
267 // Call the runtime to declare the globals. The inevitable call 267 // Call the runtime to declare the globals. The inevitable call
268 // will sync frame elements to memory anyway, so we do it eagerly to 268 // will sync frame elements to memory anyway, so we do it eagerly to
269 // allow us to push the arguments directly into place. 269 // allow us to push the arguments directly into place.
270 frame_->SyncRange(0, frame_->element_count() - 1); 270 frame_->SyncRange(0, frame_->element_count() - 1);
271 271
272 __ movq(kScratchRegister, pairs, RelocInfo::EMBEDDED_OBJECT); 272 __ movq(kScratchRegister, pairs, RelocInfo::EMBEDDED_OBJECT);
273 frame_->EmitPush(rsi); // The context is the first argument.
273 frame_->EmitPush(kScratchRegister); 274 frame_->EmitPush(kScratchRegister);
274 frame_->EmitPush(rsi); // The context is the second argument.
275 frame_->EmitPush(Smi::FromInt(is_eval() ? 1 : 0)); 275 frame_->EmitPush(Smi::FromInt(is_eval() ? 1 : 0));
276 Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 3); 276 Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 3);
277 // Return value is ignored. 277 // Return value is ignored.
278 } 278 }
279 279
280 280
281 void CodeGenerator::GenCode(FunctionLiteral* function) { 281 void CodeGenerator::GenCode(FunctionLiteral* function) {
282 // Record the position for debugging purposes. 282 // Record the position for debugging purposes.
283 CodeForFunctionPosition(function); 283 CodeForFunctionPosition(function);
284 ZoneList<Statement*>* body = function->body(); 284 ZoneList<Statement*>* body = function->body();
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
2170 2170
2171 2171
2172 void CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) { 2172 void CodeGenerator::InstantiateBoilerplate(Handle<JSFunction> boilerplate) {
2173 // Call the runtime to instantiate the function boilerplate object. 2173 // Call the runtime to instantiate the function boilerplate object.
2174 // The inevitable call will sync frame elements to memory anyway, so 2174 // The inevitable call will sync frame elements to memory anyway, so
2175 // we do it eagerly to allow us to push the arguments directly into 2175 // we do it eagerly to allow us to push the arguments directly into
2176 // place. 2176 // place.
2177 ASSERT(boilerplate->IsBoilerplate()); 2177 ASSERT(boilerplate->IsBoilerplate());
2178 frame_->SyncRange(0, frame_->element_count() - 1); 2178 frame_->SyncRange(0, frame_->element_count() - 1);
2179 2179
2180 // Push the boilerplate on the stack. 2180 // Create a new closure.
2181 frame_->EmitPush(rsi);
2181 __ movq(kScratchRegister, boilerplate, RelocInfo::EMBEDDED_OBJECT); 2182 __ movq(kScratchRegister, boilerplate, RelocInfo::EMBEDDED_OBJECT);
2182 frame_->EmitPush(kScratchRegister); 2183 frame_->EmitPush(kScratchRegister);
2183
2184 // Create a new closure.
2185 frame_->EmitPush(rsi);
2186 Result result = frame_->CallRuntime(Runtime::kNewClosure, 2); 2184 Result result = frame_->CallRuntime(Runtime::kNewClosure, 2);
2187 frame_->Push(&result); 2185 frame_->Push(&result);
2188 } 2186 }
2189 2187
2190 2188
2191 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) { 2189 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) {
2192 Comment cmnt(masm_, "[ FunctionLiteral"); 2190 Comment cmnt(masm_, "[ FunctionLiteral");
2193 2191
2194 // Build the function boilerplate and instantiate it. 2192 // Build the function boilerplate and instantiate it.
2195 Handle<JSFunction> boilerplate = BuildBoilerplate(node); 2193 Handle<JSFunction> boilerplate = BuildBoilerplate(node);
(...skipping 5446 matching lines...) Expand 10 before | Expand all | Expand 10 after
7642 int CompareStub::MinorKey() { 7640 int CompareStub::MinorKey() {
7643 // Encode the two parameters in a unique 16 bit value. 7641 // Encode the two parameters in a unique 16 bit value.
7644 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7642 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7645 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7643 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7646 } 7644 }
7647 7645
7648 7646
7649 #undef __ 7647 #undef __
7650 7648
7651 } } // namespace v8::internal 7649 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/x64/fast-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698