OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 | 1379 |
1380 // Allocation done. | 1380 // Allocation done. |
1381 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); | 1381 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); |
1382 } | 1382 } |
1383 | 1383 |
1384 | 1384 |
1385 void Scope::AllocateModulesRecursively(Scope* host_scope) { | 1385 void Scope::AllocateModulesRecursively(Scope* host_scope) { |
1386 if (already_resolved()) return; | 1386 if (already_resolved()) return; |
1387 if (is_module_scope()) { | 1387 if (is_module_scope()) { |
1388 ASSERT(interface_->IsFrozen()); | 1388 ASSERT(interface_->IsFrozen()); |
1389 const char raw_name[] = ".module"; | 1389 Handle<String> name = isolate_->factory()->LookupOneByteSymbol( |
1390 Handle<String> name = isolate_->factory()->LookupSymbol( | 1390 STATIC_ASCII_VECTOR(".module")); |
1391 Vector<const char>(raw_name, StrLength(raw_name))); | |
1392 ASSERT(module_var_ == NULL); | 1391 ASSERT(module_var_ == NULL); |
1393 module_var_ = host_scope->NewInternal(name); | 1392 module_var_ = host_scope->NewInternal(name); |
1394 ++host_scope->num_modules_; | 1393 ++host_scope->num_modules_; |
1395 } | 1394 } |
1396 | 1395 |
1397 for (int i = 0; i < inner_scopes_.length(); i++) { | 1396 for (int i = 0; i < inner_scopes_.length(); i++) { |
1398 Scope* inner_scope = inner_scopes_.at(i); | 1397 Scope* inner_scope = inner_scopes_.at(i); |
1399 inner_scope->AllocateModulesRecursively(host_scope); | 1398 inner_scope->AllocateModulesRecursively(host_scope); |
1400 } | 1399 } |
1401 } | 1400 } |
1402 | 1401 |
1403 | 1402 |
1404 int Scope::StackLocalCount() const { | 1403 int Scope::StackLocalCount() const { |
1405 return num_stack_slots() - | 1404 return num_stack_slots() - |
1406 (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0); | 1405 (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0); |
1407 } | 1406 } |
1408 | 1407 |
1409 | 1408 |
1410 int Scope::ContextLocalCount() const { | 1409 int Scope::ContextLocalCount() const { |
1411 if (num_heap_slots() == 0) return 0; | 1410 if (num_heap_slots() == 0) return 0; |
1412 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1411 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1413 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1412 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1414 } | 1413 } |
1415 | 1414 |
1416 } } // namespace v8::internal | 1415 } } // namespace v8::internal |
OLD | NEW |