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

Side by Side Diff: src/codegen.cc

Issue 14170: Refactored the recording of source position in the generated code. The code g... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years 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/assembler-ia32.cc ('k') | src/codegen-arm.h » ('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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 22 matching lines...) Expand all
33 #include "prettyprinter.h" 33 #include "prettyprinter.h"
34 #include "scopeinfo.h" 34 #include "scopeinfo.h"
35 #include "runtime.h" 35 #include "runtime.h"
36 #include "stub-cache.h" 36 #include "stub-cache.h"
37 37
38 namespace v8 { namespace internal { 38 namespace v8 { namespace internal {
39 39
40 DeferredCode::DeferredCode(CodeGenerator* generator) 40 DeferredCode::DeferredCode(CodeGenerator* generator)
41 : masm_(generator->masm()), 41 : masm_(generator->masm()),
42 generator_(generator), 42 generator_(generator),
43 statement_position_(masm_->last_statement_position()), 43 statement_position_(masm_->current_statement_position()),
44 position_(masm_->last_position()) { 44 position_(masm_->current_position()) {
45 generator->AddDeferred(this); 45 generator->AddDeferred(this);
46 ASSERT(statement_position_ != RelocInfo::kNoPosition);
47 ASSERT(position_ != RelocInfo::kNoPosition);
46 #ifdef DEBUG 48 #ifdef DEBUG
47 comment_ = ""; 49 comment_ = "";
48 #endif 50 #endif
49 } 51 }
50 52
51 53
52 void CodeGenerator::ProcessDeferred() { 54 void CodeGenerator::ProcessDeferred() {
53 while (!deferred_.is_empty()) { 55 while (!deferred_.is_empty()) {
54 DeferredCode* code = deferred_.RemoveLast(); 56 DeferredCode* code = deferred_.RemoveLast();
55 MacroAssembler* masm = code->masm(); 57 MacroAssembler* masm = code->masm();
56 // Record position of deferred code stub. 58 // Record position of deferred code stub.
57 if (code->statement_position() != RelocInfo::kNoPosition) { 59 masm->RecordStatementPosition(code->statement_position());
58 masm->RecordStatementPosition(code->statement_position());
59 }
60 if (code->position() != RelocInfo::kNoPosition) { 60 if (code->position() != RelocInfo::kNoPosition) {
61 masm->RecordPosition(code->position()); 61 masm->RecordPosition(code->position());
62 } 62 }
63 // Bind labels and generate the code. 63 // Bind labels and generate the code.
64 masm->bind(code->enter()); 64 masm->bind(code->enter());
65 Comment cmnt(masm, code->comment()); 65 Comment cmnt(masm, code->comment());
66 code->Generate(); 66 code->Generate();
67 if (code->exit()->is_bound()) { 67 if (code->exit()->is_bound()) {
68 masm->jmp(code->exit()); // platform independent? 68 masm->jmp(code->exit()); // platform independent?
69 } 69 }
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 if (range / FastCaseSwitchMaxOverheadFactor() > length) { 457 if (range / FastCaseSwitchMaxOverheadFactor() > length) {
458 return false; // range of labels is too sparse 458 return false; // range of labels is too sparse
459 } 459 }
460 460
461 // Optimization accepted, generate code. 461 // Optimization accepted, generate code.
462 GenerateFastCaseSwitchStatement(node, min_index, range, default_index); 462 GenerateFastCaseSwitchStatement(node, min_index, range, default_index);
463 return true; 463 return true;
464 } 464 }
465 465
466 466
467 void CodeGenerator::CodeForStatement(Node* node) {
468 if (FLAG_debug_info) {
469 int pos = node->statement_pos();
470 if (pos != RelocInfo::kNoPosition) {
471 masm()->RecordStatementPosition(pos);
472 CodeForSourcePosition(pos);
473 }
474 }
475 }
476
477
478 void CodeGenerator::CodeForSourcePosition(int pos) {
479 if (FLAG_debug_info) {
480 if (pos != RelocInfo::kNoPosition) {
481 masm()->RecordPosition(pos);
482 }
483 }
484 }
485
486
467 const char* RuntimeStub::GetName() { 487 const char* RuntimeStub::GetName() {
468 return Runtime::FunctionForId(id_)->stub_name; 488 return Runtime::FunctionForId(id_)->stub_name;
469 } 489 }
470 490
471 491
472 void RuntimeStub::Generate(MacroAssembler* masm) { 492 void RuntimeStub::Generate(MacroAssembler* masm) {
473 masm->TailCallRuntime(ExternalReference(id_), num_arguments_); 493 masm->TailCallRuntime(ExternalReference(id_), num_arguments_);
474 } 494 }
475 495
476 496
477 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { 497 void ArgumentsAccessStub::Generate(MacroAssembler* masm) {
478 switch (type_) { 498 switch (type_) {
479 case READ_LENGTH: GenerateReadLength(masm); break; 499 case READ_LENGTH: GenerateReadLength(masm); break;
480 case READ_ELEMENT: GenerateReadElement(masm); break; 500 case READ_ELEMENT: GenerateReadElement(masm); break;
481 case NEW_OBJECT: GenerateNewObject(masm); break; 501 case NEW_OBJECT: GenerateNewObject(masm); break;
482 } 502 }
483 } 503 }
484 504
485 505
486 } } // namespace v8::internal 506 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler-ia32.cc ('k') | src/codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698