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

Side by Side Diff: src/codegen.cc

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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/codegen.h ('k') | src/compilation-cache.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 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 25 matching lines...) Expand all
36 #include "register-allocator-inl.h" 36 #include "register-allocator-inl.h"
37 #include "rewriter.h" 37 #include "rewriter.h"
38 #include "runtime.h" 38 #include "runtime.h"
39 #include "scopeinfo.h" 39 #include "scopeinfo.h"
40 #include "stub-cache.h" 40 #include "stub-cache.h"
41 41
42 namespace v8 { 42 namespace v8 {
43 namespace internal { 43 namespace internal {
44 44
45 45
46 CodeGenerator* CodeGeneratorScope::top_ = NULL; 46 CodeGeneratorData::CodeGeneratorData()
47 :top_(NULL),
48 compiling_deferred_code_(false),
49 frame_element_constants_list_(NULL),
50 result_constants_list_(NULL) {
51 }
52
53 CodeGeneratorData::~CodeGeneratorData() {
54 delete result_constants_list_;
55 delete frame_element_constants_list_;
56 }
57
58 // we cannot allocate ZoneObjectList because it goes to some zone unexpectedly,
59 // and after that to unexpected death so we create ZoneObjectList as member of
60 // malloced class and take the only field
61 struct NonZoneObjectListHolder {
62 ZoneObjectList zone_list;
63 NonZoneObjectListHolder():zone_list(10) {
64 ASSERT(sizeof(NonZoneObjectListHolder) == sizeof(zone_list));
65 ASSERT(reinterpret_cast<int>(this) == reinterpret_cast<int>(&zone_list));
66 }
67 };
68
69 ZoneObjectList* CodeGeneratorData::result_constants_list() {
70 if (!result_constants_list_) result_constants_list_ = &(
71 (new NonZoneObjectListHolder())->zone_list);
72 return result_constants_list_;
73 }
74
75 ZoneObjectList* CodeGeneratorData::frame_element_constants_list() {
76 if (!frame_element_constants_list_) frame_element_constants_list_ =
77 &((new NonZoneObjectListHolder())->zone_list);
78 return frame_element_constants_list_;
79 }
47 80
48 81
49 DeferredCode::DeferredCode() 82 DeferredCode::DeferredCode()
50 : masm_(CodeGeneratorScope::Current()->masm()), 83 : masm_(CodeGeneratorScope::Current()->masm()),
51 statement_position_(masm_->current_statement_position()), 84 statement_position_(masm_->current_statement_position()),
52 position_(masm_->current_position()) { 85 position_(masm_->current_position()) {
53 ASSERT(statement_position_ != RelocInfo::kNoPosition); 86 ASSERT(statement_position_ != RelocInfo::kNoPosition);
54 ASSERT(position_ != RelocInfo::kNoPosition); 87 ASSERT(position_ != RelocInfo::kNoPosition);
55 88
56 CodeGeneratorScope::Current()->AddDeferred(this); 89 CodeGeneratorScope::Current()->AddDeferred(this);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (stream.has_more()) PrintF("%c", stream.GetNext()); 231 if (stream.has_more()) PrintF("%c", stream.GetNext());
199 } 232 }
200 PrintF("\n\n"); 233 PrintF("\n\n");
201 } 234 }
202 PrintF("--- Code ---\n"); 235 PrintF("--- Code ---\n");
203 code->Disassemble(*fun->name()->ToCString()); 236 code->Disassemble(*fun->name()->ToCString());
204 } 237 }
205 #endif // ENABLE_DISASSEMBLER 238 #endif // ENABLE_DISASSEMBLER
206 239
207 if (!code.is_null()) { 240 if (!code.is_null()) {
208 Counters::total_compiled_code_size.Increment(code->instruction_size()); 241 INCREMENT_COUNTER(total_compiled_code_size, code->instruction_size());
209 } 242 }
210 return code; 243 return code;
211 } 244 }
212 245
213 246
214 // Generate the code. Takes a function literal, generates code for it, assemble 247 // Generate the code. Takes a function literal, generates code for it, assemble
215 // all the pieces into a Code object. This function is only to be called by 248 // all the pieces into a Code object. This function is only to be called by
216 // the compiler.cc code. 249 // the compiler.cc code.
217 Handle<Code> CodeGenerator::MakeCode(FunctionLiteral* fun, 250 Handle<Code> CodeGenerator::MakeCode(FunctionLiteral* fun,
218 Handle<Script> script, 251 Handle<Script> script,
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 510 }
478 } 511 }
479 512
480 513
481 void ApiGetterEntryStub::SetCustomCache(Code* value) { 514 void ApiGetterEntryStub::SetCustomCache(Code* value) {
482 info()->set_load_stub_cache(value); 515 info()->set_load_stub_cache(value);
483 } 516 }
484 517
485 518
486 } } // namespace v8::internal 519 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.h ('k') | src/compilation-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698