OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 /* nothing to do */ | 48 /* nothing to do */ |
49 virtual ~ZoneAllocator() {} | 49 virtual ~ZoneAllocator() {} |
50 | 50 |
51 virtual void* New(size_t size) { return ZONE->New(static_cast<int>(size)); } | 51 virtual void* New(size_t size) { return ZONE->New(static_cast<int>(size)); } |
52 | 52 |
53 /* ignored - Zone is freed in one fell swoop */ | 53 /* ignored - Zone is freed in one fell swoop */ |
54 virtual void Delete(void* p) {} | 54 virtual void Delete(void* p) {} |
55 }; | 55 }; |
56 | 56 |
57 | 57 |
58 static ZoneAllocator* LocalsMapAllocator = ::new ZoneAllocator(); | 58 static ZoneAllocator* LocalsMapAllocator = new ZoneAllocator(); |
59 | 59 |
60 | 60 |
61 // ---------------------------------------------------------------------------- | 61 // ---------------------------------------------------------------------------- |
62 // Implementation of LocalsMap | 62 // Implementation of LocalsMap |
63 // | 63 // |
64 // Note: We are storing the handle locations as key values in the hash map. | 64 // Note: We are storing the handle locations as key values in the hash map. |
65 // When inserting a new variable via Declare(), we rely on the fact that | 65 // When inserting a new variable via Declare(), we rely on the fact that |
66 // the handle location remains alive for the duration of that variable | 66 // the handle location remains alive for the duration of that variable |
67 // use. Because a Variable holding a handle with the same location exists | 67 // use. Because a Variable holding a handle with the same location exists |
68 // this is ensured. | 68 // this is ensured. |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 } | 1178 } |
1179 | 1179 |
1180 | 1180 |
1181 int Scope::ContextLocalCount() const { | 1181 int Scope::ContextLocalCount() const { |
1182 if (num_heap_slots() == 0) return 0; | 1182 if (num_heap_slots() == 0) return 0; |
1183 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1183 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1184 (function_ != NULL && function_->var()->IsContextSlot() ? 1 : 0); | 1184 (function_ != NULL && function_->var()->IsContextSlot() ? 1 : 0); |
1185 } | 1185 } |
1186 | 1186 |
1187 } } // namespace v8::internal | 1187 } } // namespace v8::internal |
OLD | NEW |