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

Side by Side Diff: src/scopes.cc

Issue 8551006: Version 3.7.9. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 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
« no previous file with comments | « src/runtime.cc ('k') | src/serialize.cc » ('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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 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.
69 69
70 static bool Match(void* key1, void* key2) { 70 static bool Match(void* key1, void* key2) {
71 String* name1 = *reinterpret_cast<String**>(key1); 71 String* name1 = *reinterpret_cast<String**>(key1);
72 String* name2 = *reinterpret_cast<String**>(key2); 72 String* name2 = *reinterpret_cast<String**>(key2);
73 ASSERT(name1->IsSymbol()); 73 ASSERT(name1->IsSymbol());
74 ASSERT(name2->IsSymbol()); 74 ASSERT(name2->IsSymbol());
75 return name1 == name2; 75 return name1 == name2;
76 } 76 }
77 77
78 78
79 VariableMap::VariableMap() : HashMap(Match, &LocalsMapAllocator, 8) {} 79 VariableMap::VariableMap() : HashMap(Match, LocalsMapAllocator, 8) {}
80 VariableMap::~VariableMap() {} 80 VariableMap::~VariableMap() {}
81 81
82 82
83 Variable* VariableMap::Declare( 83 Variable* VariableMap::Declare(
84 Scope* scope, 84 Scope* scope,
85 Handle<String> name, 85 Handle<String> name,
86 VariableMode mode, 86 VariableMode mode,
87 bool is_valid_lhs, 87 bool is_valid_lhs,
88 Variable::Kind kind, 88 Variable::Kind kind,
89 InitializationFlag initialization_flag) { 89 InitializationFlag initialization_flag) {
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698