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

Side by Side Diff: src/scopeinfo.cc

Issue 11093074: Get rid of static module allocation, do it in code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed last comments; added other back-ends Created 8 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/scopeinfo.h ('k') | src/scopes.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 if (name == get(i)) { 314 if (name == get(i)) {
315 int var = i - start; 315 int var = i - start;
316 *mode = ContextLocalMode(var); 316 *mode = ContextLocalMode(var);
317 *init_flag = ContextLocalInitFlag(var); 317 *init_flag = ContextLocalInitFlag(var);
318 result = Context::MIN_CONTEXT_SLOTS + var; 318 result = Context::MIN_CONTEXT_SLOTS + var;
319 context_slot_cache->Update(this, name, *mode, *init_flag, result); 319 context_slot_cache->Update(this, name, *mode, *init_flag, result);
320 ASSERT(result < ContextLength()); 320 ASSERT(result < ContextLength());
321 return result; 321 return result;
322 } 322 }
323 } 323 }
324 // Cache as not found. Mode and init flag don't matter.
324 context_slot_cache->Update(this, name, INTERNAL, kNeedsInitialization, -1); 325 context_slot_cache->Update(this, name, INTERNAL, kNeedsInitialization, -1);
325 } 326 }
326 return -1; 327 return -1;
327 } 328 }
328 329
329 330
330 int ScopeInfo::ParameterIndex(String* name) { 331 int ScopeInfo::ParameterIndex(String* name) {
331 ASSERT(name->IsSymbol()); 332 ASSERT(name->IsSymbol());
332 if (length() > 0) { 333 if (length() > 0) {
333 // We must read parameters from the end since for 334 // We must read parameters from the end since for
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 PrintList("context slots", 498 PrintList("context slots",
498 Context::MIN_CONTEXT_SLOTS, 499 Context::MIN_CONTEXT_SLOTS,
499 ContextLocalNameEntriesIndex(), 500 ContextLocalNameEntriesIndex(),
500 ContextLocalNameEntriesIndex() + ContextLocalCount(), 501 ContextLocalNameEntriesIndex() + ContextLocalCount(),
501 this); 502 this);
502 503
503 PrintF("}\n"); 504 PrintF("}\n");
504 } 505 }
505 #endif // DEBUG 506 #endif // DEBUG
506 507
508
509 //---------------------------------------------------------------------------
510 // ModuleInfo.
511
512 Handle<ModuleInfo> ModuleInfo::Create(
513 Isolate* isolate, Interface* interface, Scope* scope) {
514 Handle<ModuleInfo> info = Allocate(isolate, interface->Length());
515 info->set_host_index(interface->Index());
516 int i = 0;
517 for (Interface::Iterator it = interface->iterator();
518 !it.done(); it.Advance(), ++i) {
519 Variable* var = scope->LocalLookup(it.name());
520 info->set_name(i, *it.name());
521 info->set_mode(i, var->mode());
522 ASSERT((var->mode() == MODULE) == (it.interface()->IsModule()));
523 if (var->mode() == MODULE) {
524 ASSERT(it.interface()->IsFrozen());
525 ASSERT(it.interface()->Index() >= 0);
526 info->set_index(i, it.interface()->Index());
527 } else {
528 ASSERT(var->index() >= 0);
529 info->set_index(i, var->index());
530 }
531 }
532 ASSERT(i == info->length());
533 return info;
534 }
535
507 } } // namespace v8::internal 536 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scopeinfo.h ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698