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

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

Issue 9187005: Enable optimization of top-level code. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: fixed problem with eval code, addressed comments Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 if (FLAG_trace_codegen) { 284 if (FLAG_trace_codegen) {
285 PrintF("Full Compiler - "); 285 PrintF("Full Compiler - ");
286 } 286 }
287 CodeGenerator::MakeCodePrologue(info); 287 CodeGenerator::MakeCodePrologue(info);
288 const int kInitialBufferSize = 4 * KB; 288 const int kInitialBufferSize = 4 * KB;
289 MacroAssembler masm(info->isolate(), NULL, kInitialBufferSize); 289 MacroAssembler masm(info->isolate(), NULL, kInitialBufferSize);
290 #ifdef ENABLE_GDB_JIT_INTERFACE 290 #ifdef ENABLE_GDB_JIT_INTERFACE
291 masm.positions_recorder()->StartGDBJITLineInfoRecording(); 291 masm.positions_recorder()->StartGDBJITLineInfoRecording();
292 #endif 292 #endif
293 293
294 FullCodeGenerator cgen(&masm); 294 FullCodeGenerator cgen(&masm, info);
295 cgen.Generate(info); 295 cgen.Generate();
296 if (cgen.HasStackOverflow()) { 296 if (cgen.HasStackOverflow()) {
297 ASSERT(!isolate->has_pending_exception()); 297 ASSERT(!isolate->has_pending_exception());
298 return false; 298 return false;
299 } 299 }
300 unsigned table_offset = cgen.EmitStackCheckTable(); 300 unsigned table_offset = cgen.EmitStackCheckTable();
301 301
302 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); 302 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION);
303 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); 303 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info);
304 code->set_optimizable(info->IsOptimizable()); 304 code->set_optimizable(info->IsOptimizable());
305 cgen.PopulateDeoptimizationData(code); 305 cgen.PopulateDeoptimizationData(code);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 #endif 397 #endif
398 } 398 }
399 399
400 400
401 void FullCodeGenerator::PrepareForBailoutForId(unsigned id, State state) { 401 void FullCodeGenerator::PrepareForBailoutForId(unsigned id, State state) {
402 // There's no need to prepare this code for bailouts from already optimized 402 // There's no need to prepare this code for bailouts from already optimized
403 // code or code that can't be optimized. 403 // code or code that can't be optimized.
404 if (!info_->HasDeoptimizationSupport()) return; 404 if (!info_->HasDeoptimizationSupport()) return;
405 unsigned pc_and_state = 405 unsigned pc_and_state =
406 StateField::encode(state) | PcField::encode(masm_->pc_offset()); 406 StateField::encode(state) | PcField::encode(masm_->pc_offset());
407 ASSERT(Smi::IsValid(pc_and_state));
407 BailoutEntry entry = { id, pc_and_state }; 408 BailoutEntry entry = { id, pc_and_state };
408 #ifdef DEBUG 409 #ifdef DEBUG
409 if (FLAG_enable_slow_asserts) { 410 if (FLAG_enable_slow_asserts) {
410 // Assert that we don't have multiple bailout entries for the same node. 411 // Assert that we don't have multiple bailout entries for the same node.
411 for (int i = 0; i < bailout_entries_.length(); i++) { 412 for (int i = 0; i < bailout_entries_.length(); i++) {
412 if (bailout_entries_.at(i).id == entry.id) { 413 if (bailout_entries_.at(i).id == entry.id) {
413 AstPrinter printer; 414 AstPrinter printer;
414 PrintF("%s", printer.PrintProgram(info_->function())); 415 PrintF("%s", printer.PrintProgram(info_->function()));
415 UNREACHABLE(); 416 UNREACHABLE();
416 } 417 }
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 } 1381 }
1381 1382
1382 return false; 1383 return false;
1383 } 1384 }
1384 1385
1385 1386
1386 #undef __ 1387 #undef __
1387 1388
1388 1389
1389 } } // namespace v8::internal 1390 } } // namespace v8::internal
OLDNEW
« src/compiler.cc ('K') | « src/full-codegen.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698