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

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

Issue 123018: X64 implementation starts using virtual frame and register allocators. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/frames-x64.cc » ('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 23 matching lines...) Expand all
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 // ------------------------------------------------------------------------- 37 // -------------------------------------------------------------------------
38 // Platform-specific DeferredCode functions. 38 // Platform-specific DeferredCode functions.
39 39
40 void DeferredCode::SaveRegisters() { UNIMPLEMENTED(); } 40 void DeferredCode::SaveRegisters() { UNIMPLEMENTED(); }
41 41
42 void DeferredCode::RestoreRegisters() { UNIMPLEMENTED(); } 42 void DeferredCode::RestoreRegisters() { UNIMPLEMENTED(); }
43 43
44 // -------------------------------------------------------------------------
45 // CodeGenState implementation.
46
47 CodeGenState::CodeGenState(CodeGenerator* owner)
48 : owner_(owner),
49 typeof_state_(NOT_INSIDE_TYPEOF),
50 destination_(NULL),
51 previous_(NULL) {
52 owner_->set_state(this);
53 }
54
55
56 CodeGenState::CodeGenState(CodeGenerator* owner,
57 TypeofState typeof_state,
58 ControlDestination* destination)
59 : owner_(owner),
60 typeof_state_(typeof_state),
61 destination_(destination),
62 previous_(owner->state()) {
63 owner_->set_state(this);
64 }
65
66
67 CodeGenState::~CodeGenState() {
68 ASSERT(owner_->state() == this);
69 owner_->set_state(previous_);
70 }
71
72
73 // -----------------------------------------------------------------------------
74 // CodeGenerator implementation.
44 75
45 CodeGenerator::CodeGenerator(int buffer_size, 76 CodeGenerator::CodeGenerator(int buffer_size,
46 Handle<Script> script, 77 Handle<Script> script,
47 bool is_eval) 78 bool is_eval)
48 : is_eval_(is_eval), 79 : is_eval_(is_eval),
49 script_(script), 80 script_(script),
50 deferred_(8), 81 deferred_(8),
51 masm_(new MacroAssembler(NULL, buffer_size)), 82 masm_(new MacroAssembler(NULL, buffer_size)),
52 scope_(NULL), 83 scope_(NULL),
53 frame_(NULL), 84 frame_(NULL),
(...skipping 10 matching lines...) Expand all
64 void CodeGenerator::DeclareGlobals(Handle<FixedArray> a) { 95 void CodeGenerator::DeclareGlobals(Handle<FixedArray> a) {
65 UNIMPLEMENTED(); 96 UNIMPLEMENTED();
66 } 97 }
67 98
68 void CodeGenerator::TestCodeGenerator() { 99 void CodeGenerator::TestCodeGenerator() {
69 // Generate code. 100 // Generate code.
70 ZoneScope zone_scope(DELETE_ON_EXIT); 101 ZoneScope zone_scope(DELETE_ON_EXIT);
71 const int initial_buffer_size = 4 * KB; 102 const int initial_buffer_size = 4 * KB;
72 CodeGenerator cgen(initial_buffer_size, NULL, false); 103 CodeGenerator cgen(initial_buffer_size, NULL, false);
73 CodeGeneratorScope scope(&cgen); 104 CodeGeneratorScope scope(&cgen);
105 Scope dummy_scope;
106 cgen.scope_ = &dummy_scope;
74 cgen.GenCode(NULL); 107 cgen.GenCode(NULL);
75 108
76 CodeDesc desc; 109 CodeDesc desc;
77 cgen.masm()->GetCode(&desc); 110 cgen.masm()->GetCode(&desc);
78 } 111 }
79 112
80 113
81 void CodeGenerator::GenCode(FunctionLiteral* a) { 114 void CodeGenerator::GenCode(FunctionLiteral* function) {
82 if (a != NULL) { 115 if (function != NULL) {
116 CodeForFunctionPosition(function);
117 // ASSERT(scope_ == NULL);
118 // scope_ = function->scope();
83 __ int3(); // UNIMPLEMENTED 119 __ int3(); // UNIMPLEMENTED
84 } else { 120 } else {
85 // GenCode Implementation under construction. Run by TestCodeGenerator 121 // GenCode Implementation under construction. Run by TestCodeGenerator
86 // with a == NULL. 122 // with a == NULL.
87 __ movq(rax, Immediate(0x2a)); 123 // Everything guarded by if (function) should be run, unguarded,
88 __ Ret(); 124 // once testing is over.
125 // Record the position for debugging purposes.
126 if (function) {
127 CodeForFunctionPosition(function);
128 }
129 // ZoneList<Statement*>* body = fun->body();
130
131 // Initialize state.
132 // While testing, scope is set in cgen before calling GenCode().
133 if (function) {
134 ASSERT(scope_ == NULL);
135 scope_ = function->scope();
136 }
137 ASSERT(allocator_ == NULL);
138 RegisterAllocator register_allocator(this);
139 allocator_ = &register_allocator;
140 ASSERT(frame_ == NULL);
141 frame_ = new VirtualFrame();
142 set_in_spilled_code(false);
143
144 // Adjust for function-level loop nesting.
145 // loop_nesting_ += fun->loop_nesting();
146
147 JumpTarget::set_compiling_deferred_code(false);
148
149 #ifdef DEBUG
150 if (strlen(FLAG_stop_at) > 0 &&
151 // fun->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
152 false) {
153 frame_->SpillAll();
154 __ int3();
155 }
156 #endif
157
158 // New scope to get automatic timing calculation.
159 { // NOLINT
160 HistogramTimerScope codegen_timer(&Counters::code_generation);
161 CodeGenState state(this);
162
163 // Entry:
164 // Stack: receiver, arguments, return address.
165 // ebp: caller's frame pointer
166 // esp: stack pointer
167 // edi: called JS function
168 // esi: callee's context
169 allocator_->Initialize();
170 frame_->Enter();
171
172 __ movq(rax, Immediate(0x2a));
173 __ Ret();
174 }
89 } 175 }
90 } 176 }
91 177
92 void CodeGenerator::GenerateFastCaseSwitchJumpTable(SwitchStatement* a, 178 void CodeGenerator::GenerateFastCaseSwitchJumpTable(SwitchStatement* a,
93 int b, 179 int b,
94 int c, 180 int c,
95 Label* d, 181 Label* d,
96 Vector<Label*> e, 182 Vector<Label*> e,
97 Vector<Label> f) { 183 Vector<Label> f) {
98 UNIMPLEMENTED(); 184 UNIMPLEMENTED();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 334 }
249 335
250 void CodeGenerator::VisitCompareOperation(CompareOperation* a) { 336 void CodeGenerator::VisitCompareOperation(CompareOperation* a) {
251 UNIMPLEMENTED(); 337 UNIMPLEMENTED();
252 } 338 }
253 339
254 void CodeGenerator::VisitThisFunction(ThisFunction* a) { 340 void CodeGenerator::VisitThisFunction(ThisFunction* a) {
255 UNIMPLEMENTED(); 341 UNIMPLEMENTED();
256 } 342 }
257 343
344 void CodeGenerator::GenerateArgumentsAccess(ZoneList<Expression*>* a) {
345 UNIMPLEMENTED();
346 }
347
348 void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* a) {
349 UNIMPLEMENTED();
350 }
351
352 void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* a) {
353 UNIMPLEMENTED();
354 }
355
356 void CodeGenerator::GenerateIsArray(ZoneList<Expression*>* a) {
357 UNIMPLEMENTED();
358 }
359
360 void CodeGenerator::GenerateIsNonNegativeSmi(ZoneList<Expression*>* a) {
361 UNIMPLEMENTED();
362 }
363
364 void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* a) {
365 UNIMPLEMENTED();
366 }
367
368 void CodeGenerator::GenerateLog(ZoneList<Expression*>* a) {
369 UNIMPLEMENTED();
370 }
371
372 void CodeGenerator::GenerateObjectEquals(ZoneList<Expression*>* a) {
373 UNIMPLEMENTED();
374 }
375
376 void CodeGenerator::GenerateSetValueOf(ZoneList<Expression*>* a) {
377 UNIMPLEMENTED();
378 }
379
380 void CodeGenerator::GenerateValueOf(ZoneList<Expression*>* a) {
381 UNIMPLEMENTED();
382 }
383
258 #undef __ 384 #undef __
259 // End of CodeGenerator implementation. 385 // End of CodeGenerator implementation.
260 386
261 // ----------------------------------------------------------------------------- 387 // -----------------------------------------------------------------------------
262 // Implementation of stubs. 388 // Implementation of stubs.
263 389
264 // Stub classes have public member named masm, not masm_. 390 // Stub classes have public member named masm, not masm_.
265 #define __ ACCESS_MASM(masm) 391 #define __ ACCESS_MASM(masm)
266 392
267 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { 393 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 723
598 // Restore frame pointer and return. 724 // Restore frame pointer and return.
599 __ pop(rbp); 725 __ pop(rbp);
600 __ ret(0); 726 __ ret(0);
601 } 727 }
602 728
603 729
604 #undef __ 730 #undef __
605 731
606 } } // namespace v8::internal 732 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/frames-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698