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

Side by Side Diff: src/cfg.cc

Issue 164315: Change the location set size from kPointerSize to kBitsPerPointer.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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/cfg.h ('k') | no next file » | 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 54
55 #define BAILOUT(reason) \ 55 #define BAILOUT(reason) \
56 do { return NULL; } while (false) 56 do { return NULL; } while (false)
57 57
58 Cfg* Cfg::Build() { 58 Cfg* Cfg::Build() {
59 FunctionLiteral* fun = CfgGlobals::current()->fun(); 59 FunctionLiteral* fun = CfgGlobals::current()->fun();
60 if (fun->scope()->num_heap_slots() > 0) { 60 if (fun->scope()->num_heap_slots() > 0) {
61 BAILOUT("function has context slots"); 61 BAILOUT("function has context slots");
62 } 62 }
63 if (fun->scope()->num_stack_slots() > kPointerSize) { 63 if (fun->scope()->num_stack_slots() > kBitsPerPointer) {
64 BAILOUT("function has too many locals"); 64 BAILOUT("function has too many locals");
65 } 65 }
66 if (fun->scope()->num_parameters() > kPointerSize - 1) { 66 if (fun->scope()->num_parameters() > kBitsPerPointer - 1) {
67 BAILOUT("function has too many parameters"); 67 BAILOUT("function has too many parameters");
68 } 68 }
69 if (fun->scope()->arguments() != NULL) { 69 if (fun->scope()->arguments() != NULL) {
70 BAILOUT("function uses .arguments"); 70 BAILOUT("function uses .arguments");
71 } 71 }
72 72
73 ZoneList<Statement*>* body = fun->body(); 73 ZoneList<Statement*>* body = fun->body();
74 if (body->is_empty()) { 74 if (body->is_empty()) {
75 BAILOUT("empty function body"); 75 BAILOUT("empty function body");
76 } 76 }
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 314
315 void ExpressionCfgBuilder::VisitAssignment(Assignment* expr) { 315 void ExpressionCfgBuilder::VisitAssignment(Assignment* expr) {
316 if (expr->op() != Token::ASSIGN && expr->op() != Token::INIT_VAR) { 316 if (expr->op() != Token::ASSIGN && expr->op() != Token::INIT_VAR) {
317 BAILOUT("unsupported compound assignment"); 317 BAILOUT("unsupported compound assignment");
318 } 318 }
319 Expression* lhs = expr->target(); 319 Expression* lhs = expr->target();
320 if (lhs->AsProperty() != NULL) { 320 if (lhs->AsProperty() != NULL) {
321 BAILOUT("unsupported property assignment"); 321 BAILOUT("unsupported property assignment");
322 } 322 }
323
323 Variable* var = lhs->AsVariableProxy()->AsVariable(); 324 Variable* var = lhs->AsVariableProxy()->AsVariable();
324 if (var == NULL) { 325 if (var == NULL) {
325 BAILOUT("unsupported invalid left-hand side"); 326 BAILOUT("unsupported invalid left-hand side");
326 } 327 }
327 if (var->is_global()) { 328 if (var->is_global()) {
328 BAILOUT("unsupported global variable"); 329 BAILOUT("unsupported global variable");
329 } 330 }
330 Slot* slot = var->slot(); 331 Slot* slot = var->slot();
331 ASSERT(slot != NULL); 332 ASSERT(slot != NULL);
332 if (slot->type() != Slot::PARAMETER && slot->type() != Slot::LOCAL) { 333 if (slot->type() != Slot::PARAMETER && slot->type() != Slot::LOCAL) {
333 BAILOUT("unsupported slot lhs (not a parameter or local)"); 334 BAILOUT("unsupported slot lhs (not a parameter or local)");
334 } 335 }
335 336
337 // Parameter and local slot assignments.
336 ExpressionCfgBuilder builder; 338 ExpressionCfgBuilder builder;
337 SlotLocation* loc = new SlotLocation(slot->type(), slot->index()); 339 SlotLocation* loc = new SlotLocation(slot->type(), slot->index());
338 builder.Build(expr->value(), loc); 340 builder.Build(expr->value(), loc);
339 if (builder.graph() == NULL) { 341 if (builder.graph() == NULL) {
340 BAILOUT("unsupported expression in assignment"); 342 BAILOUT("unsupported expression in assignment");
341 } 343 }
342 // If the expression did not come back in the slot location, append 344 // If the expression did not come back in the slot location, append
343 // a move to the CFG. 345 // a move to the CFG.
344 graph_ = builder.graph(); 346 graph_ = builder.graph();
345 if (builder.value() != loc) { 347 if (builder.value() != loc) {
346 graph()->Append(new MoveInstr(loc, builder.value())); 348 graph()->Append(new MoveInstr(loc, builder.value()));
347 } 349 }
348 // Record the assignment. 350 // Record the assignment.
349 assigned_vars_.AddElement(loc); 351 assigned_vars_.AddElement(loc);
350 // Ignore the destination passed to us. 352 // Ignore the destination passed to us.
351 value_ = loc; 353 value_ = loc;
352 } 354 }
353 355
354 356
355 void ExpressionCfgBuilder::VisitThrow(Throw* expr) { 357 void ExpressionCfgBuilder::VisitThrow(Throw* expr) {
356 BAILOUT("Throw"); 358 BAILOUT("Throw");
357 } 359 }
358 360
359 361
360 void ExpressionCfgBuilder::VisitProperty(Property* expr) { 362 void ExpressionCfgBuilder::VisitProperty(Property* expr) {
361 ExpressionCfgBuilder object, key; 363 ExpressionCfgBuilder object, key;
362 object.Build(expr->obj(), NULL); 364 object.Build(expr->obj(), NULL);
363 if (object.graph() == NULL) { 365 if (object.graph() == NULL) {
364 BAILOUT("unsupported object subexpression in propref"); 366 BAILOUT("unsupported object subexpression in propload");
365 } 367 }
366 key.Build(expr->key(), NULL); 368 key.Build(expr->key(), NULL);
367 if (key.graph() == NULL) { 369 if (key.graph() == NULL) {
368 BAILOUT("unsupported key subexpression in propref"); 370 BAILOUT("unsupported key subexpression in propload");
369 } 371 }
370 372
371 if (destination_ == NULL) destination_ = new TempLocation(); 373 if (destination_ == NULL) destination_ = new TempLocation();
372 374
373 graph_ = object.graph(); 375 graph_ = object.graph();
374 // Insert a move to a fresh temporary if the object value is in a slot 376 // Insert a move to a fresh temporary if the object value is in a slot
375 // that's assigned in the key. 377 // that's assigned in the key.
376 Location* temp = NULL; 378 Location* temp = NULL;
377 if (object.value()->is_slot() && 379 if (object.value()->is_slot() &&
378 key.assigned_vars()->Contains(SlotLocation::cast(object.value()))) { 380 key.assigned_vars()->Contains(SlotLocation::cast(object.value()))) {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 void ExitNode::Print() { 754 void ExitNode::Print() {
753 if (!is_marked_) { 755 if (!is_marked_) {
754 is_marked_ = true; 756 is_marked_ = true;
755 PrintF("L%d:\nExit\n\n", number()); 757 PrintF("L%d:\nExit\n\n", number());
756 } 758 }
757 } 759 }
758 760
759 #endif // DEBUG 761 #endif // DEBUG
760 762
761 } } // namespace v8::internal 763 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cfg.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698