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

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

Issue 342035: Move the Location class into the AST Expression class as a member.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 break; 66 break;
67 default: 67 default:
68 UNREACHABLE(); 68 UNREACHABLE();
69 } 69 }
70 return offset; 70 return offset;
71 } 71 }
72 72
73 73
74 // All platform macro assemblers in {ia32,x64,arm} have a push(Register) 74 // All platform macro assemblers in {ia32,x64,arm} have a push(Register)
75 // function. 75 // function.
76 void FastCodeGenerator::Move(Location destination, Register source) { 76 void FastCodeGenerator::Move(Expression::Context context, Register source) {
77 switch (destination.type()) { 77 switch (context) {
78 case Location::kUninitialized: 78 case Expression::kUninitialized:
79 UNREACHABLE(); 79 UNREACHABLE();
80 case Location::kEffect: 80 case Expression::kEffect:
81 break; 81 break;
82 case Location::kValue: 82 case Expression::kValue:
83 masm_->push(source); 83 masm_->push(source);
84 break; 84 break;
85 } 85 }
86 } 86 }
87 87
88 88
89 // All platform macro assemblers in {ia32,x64,arm} have a pop(Register)
90 // function.
91 void FastCodeGenerator::Move(Register destination, Location source) {
92 switch (source.type()) {
93 case Location::kUninitialized: // Fall through.
94 case Location::kEffect:
95 UNREACHABLE();
96 case Location::kValue:
97 masm_->pop(destination);
98 }
99 }
100
101
102 void FastCodeGenerator::VisitDeclarations( 89 void FastCodeGenerator::VisitDeclarations(
103 ZoneList<Declaration*>* declarations) { 90 ZoneList<Declaration*>* declarations) {
104 int length = declarations->length(); 91 int length = declarations->length();
105 int globals = 0; 92 int globals = 0;
106 for (int i = 0; i < length; i++) { 93 for (int i = 0; i < length; i++) {
107 Declaration* node = declarations->at(i); 94 Declaration* node = declarations->at(i);
108 Variable* var = node->proxy()->var(); 95 Variable* var = node->proxy()->var();
109 Slot* slot = var->slot(); 96 Slot* slot = var->slot();
110 97
111 // If it was not possible to allocate the variable at compile 98 // If it was not possible to allocate the variable at compile
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 303 }
317 304
318 305
319 void FastCodeGenerator::VisitSlot(Slot* expr) { 306 void FastCodeGenerator::VisitSlot(Slot* expr) {
320 // Slots do not appear directly in the AST. 307 // Slots do not appear directly in the AST.
321 UNREACHABLE(); 308 UNREACHABLE();
322 } 309 }
323 310
324 311
325 void FastCodeGenerator::VisitLiteral(Literal* expr) { 312 void FastCodeGenerator::VisitLiteral(Literal* expr) {
326 Move(expr->location(), expr); 313 Move(expr->context(), expr);
327 } 314 }
328 315
329 316
330 void FastCodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* expr) { 317 void FastCodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* expr) {
331 UNREACHABLE(); 318 UNREACHABLE();
332 } 319 }
333 320
334 321
335 void FastCodeGenerator::VisitThrow(Throw* expr) { 322 void FastCodeGenerator::VisitThrow(Throw* expr) {
336 UNREACHABLE(); 323 UNREACHABLE();
(...skipping 14 matching lines...) Expand all
351 UNREACHABLE(); 338 UNREACHABLE();
352 } 339 }
353 340
354 341
355 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { 342 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
356 UNREACHABLE(); 343 UNREACHABLE();
357 } 344 }
358 345
359 346
360 } } // namespace v8::internal 347 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698