OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 #include "src/parser.h" | 10 #include "src/parser.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // by the same AstRawString*. | 38 // by the same AstRawString*. |
39 // FIXME(marja): fix the type of Lookup. | 39 // FIXME(marja): fix the type of Lookup. |
40 Entry* p = | 40 Entry* p = |
41 ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name), name->hash(), | 41 ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name), name->hash(), |
42 ZoneAllocationPolicy(zone())); | 42 ZoneAllocationPolicy(zone())); |
43 if (p->value == NULL) { | 43 if (p->value == NULL) { |
44 // The variable has not been declared yet -> insert it. | 44 // The variable has not been declared yet -> insert it. |
45 DCHECK(p->key == name); | 45 DCHECK(p->key == name); |
46 if (kind == Variable::CLASS) { | 46 if (kind == Variable::CLASS) { |
47 p->value = new (zone()) | 47 p->value = new (zone()) |
48 ClassVariable(scope, name, mode, kind, initialization_flag, | 48 ClassVariable(scope, name, mode, initialization_flag, |
49 maybe_assigned_flag, declaration_group_start); | 49 maybe_assigned_flag, declaration_group_start); |
50 } else { | 50 } else { |
51 p->value = new (zone()) Variable( | 51 p->value = new (zone()) Variable( |
52 scope, name, mode, kind, initialization_flag, maybe_assigned_flag); | 52 scope, name, mode, kind, initialization_flag, maybe_assigned_flag); |
53 } | 53 } |
54 } | 54 } |
55 return reinterpret_cast<Variable*>(p->value); | 55 return reinterpret_cast<Variable*>(p->value); |
56 } | 56 } |
57 | 57 |
58 | 58 |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0); | 1551 (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0); |
1552 } | 1552 } |
1553 | 1553 |
1554 | 1554 |
1555 int Scope::ContextLocalCount() const { | 1555 int Scope::ContextLocalCount() const { |
1556 if (num_heap_slots() == 0) return 0; | 1556 if (num_heap_slots() == 0) return 0; |
1557 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1557 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1558 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1558 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1559 } | 1559 } |
1560 } } // namespace v8::internal | 1560 } } // namespace v8::internal |
OLD | NEW |