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

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 comments Created 8 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 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 // ModuleDescription.
511
512 Handle<ModuleDescription> ModuleDescription::Create(
513 Isolate* isolate, Interface* interface, Scope* scope) {
514 Handle<ModuleDescription> description =
515 Allocate(isolate, interface->Length());
516 description->set_host_index(interface->Index());
517 int i = 0;
518 for (Interface::Iterator it = interface->iterator();
519 !it.done(); it.Advance(), ++i) {
520 Variable* var = scope->LocalLookup(it.name());
521 description->set_name(i, *it.name());
522 description->set_mode(i, var->mode());
523 ASSERT((var->mode() == MODULE) == (it.interface()->IsModule()));
524 if (var->mode() == MODULE) {
525 ASSERT(it.interface()->IsFrozen());
526 ASSERT(it.interface()->Index() >= 0);
527 description->set_index(i, it.interface()->Index());
528 } else {
529 ASSERT(var->index() >= 0);
530 description->set_index(i, var->index());
531 }
532 }
533 ASSERT(i == description->length());
534 return description;
535 }
536
507 } } // namespace v8::internal 537 } } // namespace v8::internal
OLDNEW
« src/scopeinfo.h ('K') | « src/scopeinfo.h ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698