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

Side by Side Diff: src/codegen.cc

Issue 3432022: Clean up some messiness in Scopes. (Closed)
Patch Set: Created 10 years, 2 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
« no previous file with comments | « src/ast.cc ('k') | src/data-flow.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 StubCache::ComputeCallInitialize(argc, in_loop, Code::KEYED_CALL_IC), 282 StubCache::ComputeCallInitialize(argc, in_loop, Code::KEYED_CALL_IC),
283 Code); 283 Code);
284 } 284 }
285 285
286 void CodeGenerator::ProcessDeclarations(ZoneList<Declaration*>* declarations) { 286 void CodeGenerator::ProcessDeclarations(ZoneList<Declaration*>* declarations) {
287 int length = declarations->length(); 287 int length = declarations->length();
288 int globals = 0; 288 int globals = 0;
289 for (int i = 0; i < length; i++) { 289 for (int i = 0; i < length; i++) {
290 Declaration* node = declarations->at(i); 290 Declaration* node = declarations->at(i);
291 Variable* var = node->proxy()->var(); 291 Variable* var = node->proxy()->var();
292 Slot* slot = var->slot(); 292 Slot* slot = var->AsSlot();
293 293
294 // If it was not possible to allocate the variable at compile 294 // If it was not possible to allocate the variable at compile
295 // time, we need to "declare" it at runtime to make sure it 295 // time, we need to "declare" it at runtime to make sure it
296 // actually exists in the local context. 296 // actually exists in the local context.
297 if ((slot != NULL && slot->type() == Slot::LOOKUP) || !var->is_global()) { 297 if ((slot != NULL && slot->type() == Slot::LOOKUP) || !var->is_global()) {
298 VisitDeclaration(node); 298 VisitDeclaration(node);
299 } else { 299 } else {
300 // Count global variables and functions for later processing 300 // Count global variables and functions for later processing
301 globals++; 301 globals++;
302 } 302 }
303 } 303 }
304 304
305 // Return in case of no declared global functions or variables. 305 // Return in case of no declared global functions or variables.
306 if (globals == 0) return; 306 if (globals == 0) return;
307 307
308 // Compute array of global variable and function declarations. 308 // Compute array of global variable and function declarations.
309 Handle<FixedArray> array = Factory::NewFixedArray(2 * globals, TENURED); 309 Handle<FixedArray> array = Factory::NewFixedArray(2 * globals, TENURED);
310 for (int j = 0, i = 0; i < length; i++) { 310 for (int j = 0, i = 0; i < length; i++) {
311 Declaration* node = declarations->at(i); 311 Declaration* node = declarations->at(i);
312 Variable* var = node->proxy()->var(); 312 Variable* var = node->proxy()->var();
313 Slot* slot = var->slot(); 313 Slot* slot = var->AsSlot();
314 314
315 if ((slot != NULL && slot->type() == Slot::LOOKUP) || !var->is_global()) { 315 if ((slot != NULL && slot->type() == Slot::LOOKUP) || !var->is_global()) {
316 // Skip - already processed. 316 // Skip - already processed.
317 } else { 317 } else {
318 array->set(j++, *(var->name())); 318 array->set(j++, *(var->name()));
319 if (node->fun() == NULL) { 319 if (node->fun() == NULL) {
320 if (var->mode() == Variable::CONST) { 320 if (var->mode() == Variable::CONST) {
321 // In case this is const property use the hole. 321 // In case this is const property use the hole.
322 array->set_the_hole(j++); 322 array->set_the_hole(j++);
323 } else { 323 } else {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } 492 }
493 } 493 }
494 494
495 495
496 void ApiGetterEntryStub::SetCustomCache(Code* value) { 496 void ApiGetterEntryStub::SetCustomCache(Code* value) {
497 info()->set_load_stub_cache(value); 497 info()->set_load_stub_cache(value);
498 } 498 }
499 499
500 500
501 } } // namespace v8::internal 501 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/data-flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698