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

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

Issue 651031: Begin using a list of bailouts instead of a singleton in the fast code generator. (Closed)
Patch Set: Created 10 years, 10 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
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::Generate(CompilationInfo* info, Mode mode) { 280 void CodeGenerator::Generate(CompilationInfo* info) {
281 // Record the position for debugging purposes. 281 // Record the position for debugging purposes.
282 CodeForFunctionPosition(info->function()); 282 CodeForFunctionPosition(info->function());
283 283
284 // Initialize state. 284 // Initialize state.
285 info_ = info; 285 info_ = info;
286 ASSERT(allocator_ == NULL); 286 ASSERT(allocator_ == NULL);
287 RegisterAllocator register_allocator(this); 287 RegisterAllocator register_allocator(this);
288 allocator_ = &register_allocator; 288 allocator_ = &register_allocator;
289 ASSERT(frame_ == NULL); 289 ASSERT(frame_ == NULL);
290 frame_ = new VirtualFrame(); 290 frame_ = new VirtualFrame();
(...skipping 18 matching lines...) Expand all
309 CodeGenState state(this); 309 CodeGenState state(this);
310 310
311 // Entry: 311 // Entry:
312 // Stack: receiver, arguments, return address. 312 // Stack: receiver, arguments, return address.
313 // rbp: caller's frame pointer 313 // rbp: caller's frame pointer
314 // rsp: stack pointer 314 // rsp: stack pointer
315 // rdi: called JS function 315 // rdi: called JS function
316 // rsi: callee's context 316 // rsi: callee's context
317 allocator_->Initialize(); 317 allocator_->Initialize();
318 318
319 if (mode == PRIMARY) { 319 if (info->mode() == CompilationInfo::PRIMARY) {
320 frame_->Enter(); 320 frame_->Enter();
321 321
322 // Allocate space for locals and initialize them. 322 // Allocate space for locals and initialize them.
323 frame_->AllocateStackSlots(); 323 frame_->AllocateStackSlots();
324 324
325 // Allocate the local context if needed. 325 // Allocate the local context if needed.
326 int heap_slots = scope()->num_heap_slots(); 326 int heap_slots = scope()->num_heap_slots();
327 if (heap_slots > 0) { 327 if (heap_slots > 0) {
328 Comment cmnt(masm_, "[ allocate local context"); 328 Comment cmnt(masm_, "[ allocate local context");
329 // Allocate local context. 329 // Allocate local context.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (scope()->is_function_scope() && scope()->function() != NULL) { 400 if (scope()->is_function_scope() && scope()->function() != NULL) {
401 frame_->Push(Factory::the_hole_value()); 401 frame_->Push(Factory::the_hole_value());
402 StoreToSlot(scope()->function()->slot(), NOT_CONST_INIT); 402 StoreToSlot(scope()->function()->slot(), NOT_CONST_INIT);
403 } 403 }
404 } else { 404 } else {
405 // When used as the secondary compiler for splitting, rbp, rsi, 405 // When used as the secondary compiler for splitting, rbp, rsi,
406 // and rdi have been pushed on the stack. Adjust the virtual 406 // and rdi have been pushed on the stack. Adjust the virtual
407 // frame to match this state. 407 // frame to match this state.
408 frame_->Adjust(3); 408 frame_->Adjust(3);
409 allocator_->Unuse(rdi); 409 allocator_->Unuse(rdi);
410
411 // Bind all the bailout labels to the beginning of the function.
412 List<CompilationInfo::Bailout*>* bailouts = info->bailouts();
413 for (int i = 0; i < bailouts->length(); i++) {
414 __ bind(bailouts->at(i)->label());
415 }
410 } 416 }
411 417
412 // Initialize the function return target after the locals are set 418 // Initialize the function return target after the locals are set
413 // up, because it needs the expected frame height from the frame. 419 // up, because it needs the expected frame height from the frame.
414 function_return_.set_direction(JumpTarget::BIDIRECTIONAL); 420 function_return_.set_direction(JumpTarget::BIDIRECTIONAL);
415 function_return_is_shadowed_ = false; 421 function_return_is_shadowed_ = false;
416 422
417 // Generate code to 'execute' declarations and initialize functions 423 // Generate code to 'execute' declarations and initialize functions
418 // (source elements). In case of an illegal redeclaration we need to 424 // (source elements). In case of an illegal redeclaration we need to
419 // handle that instead of processing the declarations. 425 // handle that instead of processing the declarations.
(...skipping 9070 matching lines...) Expand 10 before | Expand all | Expand 10 after
9490 // Call the function from C++. 9496 // Call the function from C++.
9491 return FUNCTION_CAST<ModuloFunction>(buffer); 9497 return FUNCTION_CAST<ModuloFunction>(buffer);
9492 } 9498 }
9493 9499
9494 #endif 9500 #endif
9495 9501
9496 9502
9497 #undef __ 9503 #undef __
9498 9504
9499 } } // namespace v8::internal 9505 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698