OLD | NEW |
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 __ movq(kScratchRegister, pairs, RelocInfo::EMBEDDED_OBJECT); | 271 __ movq(kScratchRegister, pairs, RelocInfo::EMBEDDED_OBJECT); |
272 frame_->EmitPush(rsi); // The context is the first argument. | 272 frame_->EmitPush(rsi); // The context is the first argument. |
273 frame_->EmitPush(kScratchRegister); | 273 frame_->EmitPush(kScratchRegister); |
274 frame_->EmitPush(Smi::FromInt(is_eval() ? 1 : 0)); | 274 frame_->EmitPush(Smi::FromInt(is_eval() ? 1 : 0)); |
275 Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 3); | 275 Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 3); |
276 // Return value is ignored. | 276 // Return value is ignored. |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 void CodeGenerator::GenCode(FunctionLiteral* function) { | 280 void CodeGenerator::GenCode(FunctionLiteral* function, CompilationInfo* info) { |
281 // Record the position for debugging purposes. | 281 // Record the position for debugging purposes. |
282 CodeForFunctionPosition(function); | 282 CodeForFunctionPosition(function); |
283 ZoneList<Statement*>* body = function->body(); | 283 ZoneList<Statement*>* body = function->body(); |
284 | 284 |
285 // Initialize state. | 285 // Initialize state. |
286 ASSERT(scope_ == NULL); | 286 ASSERT(scope_ == NULL); |
287 scope_ = function->scope(); | 287 scope_ = function->scope(); |
288 ASSERT(allocator_ == NULL); | 288 ASSERT(allocator_ == NULL); |
289 RegisterAllocator register_allocator(this); | 289 RegisterAllocator register_allocator(this); |
290 allocator_ = ®ister_allocator; | 290 allocator_ = ®ister_allocator; |
291 ASSERT(frame_ == NULL); | 291 ASSERT(frame_ == NULL); |
292 frame_ = new VirtualFrame(); | 292 frame_ = new VirtualFrame(); |
293 set_in_spilled_code(false); | 293 set_in_spilled_code(false); |
294 | 294 |
295 // Adjust for function-level loop nesting. | 295 // Adjust for function-level loop nesting. |
296 loop_nesting_ += function->loop_nesting(); | 296 loop_nesting_ += info->loop_nesting(); |
297 | 297 |
298 JumpTarget::set_compiling_deferred_code(false); | 298 JumpTarget::set_compiling_deferred_code(false); |
299 | 299 |
300 #ifdef DEBUG | 300 #ifdef DEBUG |
301 if (strlen(FLAG_stop_at) > 0 && | 301 if (strlen(FLAG_stop_at) > 0 && |
302 function->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 302 function->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
303 frame_->SpillAll(); | 303 frame_->SpillAll(); |
304 __ int3(); | 304 __ int3(); |
305 } | 305 } |
306 #endif | 306 #endif |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // compile an artificial return statement just above, and (b) there | 464 // compile an artificial return statement just above, and (b) there |
465 // are return statements in the body but (c) they are all shadowed. | 465 // are return statements in the body but (c) they are all shadowed. |
466 Result return_value; | 466 Result return_value; |
467 function_return_.Bind(&return_value); | 467 function_return_.Bind(&return_value); |
468 GenerateReturnSequence(&return_value); | 468 GenerateReturnSequence(&return_value); |
469 } | 469 } |
470 } | 470 } |
471 } | 471 } |
472 | 472 |
473 // Adjust for function-level loop nesting. | 473 // Adjust for function-level loop nesting. |
474 loop_nesting_ -= function->loop_nesting(); | 474 loop_nesting_ -= info->loop_nesting(); |
475 | 475 |
476 // Code generation state must be reset. | 476 // Code generation state must be reset. |
477 ASSERT(state_ == NULL); | 477 ASSERT(state_ == NULL); |
478 ASSERT(loop_nesting() == 0); | 478 ASSERT(loop_nesting() == 0); |
479 ASSERT(!function_return_is_shadowed_); | 479 ASSERT(!function_return_is_shadowed_); |
480 function_return_.Unuse(); | 480 function_return_.Unuse(); |
481 DeleteFrame(); | 481 DeleteFrame(); |
482 | 482 |
483 // Process any deferred code using the register allocator. | 483 // Process any deferred code using the register allocator. |
484 if (!HasStackOverflow()) { | 484 if (!HasStackOverflow()) { |
(...skipping 8363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8848 // Call the function from C++. | 8848 // Call the function from C++. |
8849 return FUNCTION_CAST<ModuloFunction>(buffer); | 8849 return FUNCTION_CAST<ModuloFunction>(buffer); |
8850 } | 8850 } |
8851 | 8851 |
8852 #endif | 8852 #endif |
8853 | 8853 |
8854 | 8854 |
8855 #undef __ | 8855 #undef __ |
8856 | 8856 |
8857 } } // namespace v8::internal | 8857 } } // namespace v8::internal |
OLD | NEW |