OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/ast/scopeinfo.h" | 5 #include "src/ast/scopeinfo.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 | 15 |
16 Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, | 16 Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, |
17 Scope* scope) { | 17 Scope* scope) { |
18 // Collect stack and context locals. | 18 // Collect stack and context locals. |
19 ZoneList<Variable*> stack_locals(scope->StackLocalCount(), zone); | 19 ZoneList<Variable*> stack_locals(scope->StackLocalCount(), zone); |
20 ZoneList<Variable*> context_locals(scope->ContextLocalCount(), zone); | 20 ZoneList<Variable*> context_locals(scope->ContextLocalCount(), zone); |
21 ZoneList<Variable*> context_globals(scope->ContextGlobalCount(), zone); | 21 ZoneList<Variable*> context_globals(scope->ContextGlobalCount(), zone); |
22 ZoneList<Variable*> strong_mode_free_variables(0, zone); | |
23 | 22 |
24 scope->CollectStackAndContextLocals(&stack_locals, &context_locals, | 23 scope->CollectStackAndContextLocals(&stack_locals, &context_locals, |
25 &context_globals, | 24 &context_globals); |
26 &strong_mode_free_variables); | |
27 const int stack_local_count = stack_locals.length(); | 25 const int stack_local_count = stack_locals.length(); |
28 const int context_local_count = context_locals.length(); | 26 const int context_local_count = context_locals.length(); |
29 const int context_global_count = context_globals.length(); | 27 const int context_global_count = context_globals.length(); |
30 const int strong_mode_free_variable_count = | |
31 strong_mode_free_variables.length(); | |
32 // Make sure we allocate the correct amount. | 28 // Make sure we allocate the correct amount. |
33 DCHECK_EQ(scope->ContextLocalCount(), context_local_count); | 29 DCHECK_EQ(scope->ContextLocalCount(), context_local_count); |
34 DCHECK_EQ(scope->ContextGlobalCount(), context_global_count); | 30 DCHECK_EQ(scope->ContextGlobalCount(), context_global_count); |
35 | 31 |
36 // Determine use and location of the "this" binding if it is present. | 32 // Determine use and location of the "this" binding if it is present. |
37 VariableAllocationInfo receiver_info; | 33 VariableAllocationInfo receiver_info; |
38 if (scope->has_this_declaration()) { | 34 if (scope->has_this_declaration()) { |
39 Variable* var = scope->receiver(); | 35 Variable* var = scope->receiver(); |
40 if (!var->is_used()) { | 36 if (!var->is_used()) { |
41 receiver_info = UNUSED; | 37 receiver_info = UNUSED; |
(...skipping 28 matching lines...) Expand all Loading... |
70 function_variable_mode = VAR; | 66 function_variable_mode = VAR; |
71 } | 67 } |
72 DCHECK(context_global_count == 0 || scope->scope_type() == SCRIPT_SCOPE); | 68 DCHECK(context_global_count == 0 || scope->scope_type() == SCRIPT_SCOPE); |
73 | 69 |
74 const bool has_function_name = function_name_info != NONE; | 70 const bool has_function_name = function_name_info != NONE; |
75 const bool has_receiver = receiver_info == STACK || receiver_info == CONTEXT; | 71 const bool has_receiver = receiver_info == STACK || receiver_info == CONTEXT; |
76 const int parameter_count = scope->num_parameters(); | 72 const int parameter_count = scope->num_parameters(); |
77 const int length = kVariablePartIndex + parameter_count + | 73 const int length = kVariablePartIndex + parameter_count + |
78 (1 + stack_local_count) + 2 * context_local_count + | 74 (1 + stack_local_count) + 2 * context_local_count + |
79 2 * context_global_count + | 75 2 * context_global_count + |
80 3 * strong_mode_free_variable_count + | |
81 (has_receiver ? 1 : 0) + (has_function_name ? 2 : 0); | 76 (has_receiver ? 1 : 0) + (has_function_name ? 2 : 0); |
82 | 77 |
83 Factory* factory = isolate->factory(); | 78 Factory* factory = isolate->factory(); |
84 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); | 79 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); |
85 | 80 |
86 bool has_simple_parameters = | 81 bool has_simple_parameters = |
87 scope->is_function_scope() && scope->has_simple_parameters(); | 82 scope->is_function_scope() && scope->has_simple_parameters(); |
88 | 83 |
89 // Encode the flags. | 84 // Encode the flags. |
90 int flags = ScopeTypeField::encode(scope->scope_type()) | | 85 int flags = ScopeTypeField::encode(scope->scope_type()) | |
91 CallsEvalField::encode(scope->calls_eval()) | | 86 CallsEvalField::encode(scope->calls_eval()) | |
92 LanguageModeField::encode(scope->language_mode()) | | 87 LanguageModeField::encode(scope->language_mode()) | |
93 DeclarationScopeField::encode(scope->is_declaration_scope()) | | 88 DeclarationScopeField::encode(scope->is_declaration_scope()) | |
94 ReceiverVariableField::encode(receiver_info) | | 89 ReceiverVariableField::encode(receiver_info) | |
95 HasNewTargetField::encode(has_new_target) | | 90 HasNewTargetField::encode(has_new_target) | |
96 FunctionVariableField::encode(function_name_info) | | 91 FunctionVariableField::encode(function_name_info) | |
97 FunctionVariableMode::encode(function_variable_mode) | | 92 FunctionVariableMode::encode(function_variable_mode) | |
98 AsmModuleField::encode(scope->asm_module()) | | 93 AsmModuleField::encode(scope->asm_module()) | |
99 AsmFunctionField::encode(scope->asm_function()) | | 94 AsmFunctionField::encode(scope->asm_function()) | |
100 HasSimpleParametersField::encode(has_simple_parameters) | | 95 HasSimpleParametersField::encode(has_simple_parameters) | |
101 FunctionKindField::encode(scope->function_kind()); | 96 FunctionKindField::encode(scope->function_kind()); |
102 scope_info->SetFlags(flags); | 97 scope_info->SetFlags(flags); |
103 scope_info->SetParameterCount(parameter_count); | 98 scope_info->SetParameterCount(parameter_count); |
104 scope_info->SetStackLocalCount(stack_local_count); | 99 scope_info->SetStackLocalCount(stack_local_count); |
105 scope_info->SetContextLocalCount(context_local_count); | 100 scope_info->SetContextLocalCount(context_local_count); |
106 scope_info->SetContextGlobalCount(context_global_count); | 101 scope_info->SetContextGlobalCount(context_global_count); |
107 scope_info->SetStrongModeFreeVariableCount(strong_mode_free_variable_count); | |
108 | 102 |
109 int index = kVariablePartIndex; | 103 int index = kVariablePartIndex; |
110 // Add parameters. | 104 // Add parameters. |
111 DCHECK(index == scope_info->ParameterEntriesIndex()); | 105 DCHECK(index == scope_info->ParameterEntriesIndex()); |
112 for (int i = 0; i < parameter_count; ++i) { | 106 for (int i = 0; i < parameter_count; ++i) { |
113 scope_info->set(index++, *scope->parameter(i)->name()); | 107 scope_info->set(index++, *scope->parameter(i)->name()); |
114 } | 108 } |
115 | 109 |
116 // Add stack locals' names. We are assuming that the stack locals' | 110 // Add stack locals' names. We are assuming that the stack locals' |
117 // slots are allocated in increasing order, so we can simply add | 111 // slots are allocated in increasing order, so we can simply add |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 for (int i = 0; i < context_global_count; ++i) { | 160 for (int i = 0; i < context_global_count; ++i) { |
167 Variable* var = context_globals[i]; | 161 Variable* var = context_globals[i]; |
168 // TODO(ishell): do we need this kind of info for globals here? | 162 // TODO(ishell): do we need this kind of info for globals here? |
169 uint32_t value = | 163 uint32_t value = |
170 ContextLocalMode::encode(var->mode()) | | 164 ContextLocalMode::encode(var->mode()) | |
171 ContextLocalInitFlag::encode(var->initialization_flag()) | | 165 ContextLocalInitFlag::encode(var->initialization_flag()) | |
172 ContextLocalMaybeAssignedFlag::encode(var->maybe_assigned()); | 166 ContextLocalMaybeAssignedFlag::encode(var->maybe_assigned()); |
173 scope_info->set(index++, Smi::FromInt(value)); | 167 scope_info->set(index++, Smi::FromInt(value)); |
174 } | 168 } |
175 | 169 |
176 DCHECK(index == scope_info->StrongModeFreeVariableNameEntriesIndex()); | |
177 for (int i = 0; i < strong_mode_free_variable_count; ++i) { | |
178 scope_info->set(index++, *strong_mode_free_variables[i]->name()); | |
179 } | |
180 | |
181 DCHECK(index == scope_info->StrongModeFreeVariablePositionEntriesIndex()); | |
182 for (int i = 0; i < strong_mode_free_variable_count; ++i) { | |
183 // Unfortunately, the source code positions are stored as int even though | |
184 // int32_t would be enough (given the maximum source code length). | |
185 Handle<Object> start_position = factory->NewNumberFromInt( | |
186 static_cast<int32_t>(strong_mode_free_variables[i] | |
187 ->strong_mode_reference_start_position())); | |
188 scope_info->set(index++, *start_position); | |
189 Handle<Object> end_position = factory->NewNumberFromInt( | |
190 static_cast<int32_t>(strong_mode_free_variables[i] | |
191 ->strong_mode_reference_end_position())); | |
192 scope_info->set(index++, *end_position); | |
193 } | |
194 | |
195 // If the receiver is allocated, add its index. | 170 // If the receiver is allocated, add its index. |
196 DCHECK(index == scope_info->ReceiverEntryIndex()); | 171 DCHECK(index == scope_info->ReceiverEntryIndex()); |
197 if (has_receiver) { | 172 if (has_receiver) { |
198 int var_index = scope->receiver()->index(); | 173 int var_index = scope->receiver()->index(); |
199 scope_info->set(index++, Smi::FromInt(var_index)); | 174 scope_info->set(index++, Smi::FromInt(var_index)); |
200 // ?? DCHECK(receiver_info != CONTEXT || var_index == | 175 // ?? DCHECK(receiver_info != CONTEXT || var_index == |
201 // scope_info->ContextLength() - 1); | 176 // scope_info->ContextLength() - 1); |
202 } | 177 } |
203 | 178 |
204 // If present, add the function variable name and its index. | 179 // If present, add the function variable name and its index. |
(...skipping 14 matching lines...) Expand all Loading... |
219 return scope_info; | 194 return scope_info; |
220 } | 195 } |
221 | 196 |
222 | 197 |
223 Handle<ScopeInfo> ScopeInfo::CreateGlobalThisBinding(Isolate* isolate) { | 198 Handle<ScopeInfo> ScopeInfo::CreateGlobalThisBinding(Isolate* isolate) { |
224 DCHECK(isolate->bootstrapper()->IsActive()); | 199 DCHECK(isolate->bootstrapper()->IsActive()); |
225 | 200 |
226 const int stack_local_count = 0; | 201 const int stack_local_count = 0; |
227 const int context_local_count = 1; | 202 const int context_local_count = 1; |
228 const int context_global_count = 0; | 203 const int context_global_count = 0; |
229 const int strong_mode_free_variable_count = 0; | |
230 const bool has_simple_parameters = true; | 204 const bool has_simple_parameters = true; |
231 const VariableAllocationInfo receiver_info = CONTEXT; | 205 const VariableAllocationInfo receiver_info = CONTEXT; |
232 const VariableAllocationInfo function_name_info = NONE; | 206 const VariableAllocationInfo function_name_info = NONE; |
233 const VariableMode function_variable_mode = VAR; | 207 const VariableMode function_variable_mode = VAR; |
234 const bool has_function_name = false; | 208 const bool has_function_name = false; |
235 const bool has_receiver = true; | 209 const bool has_receiver = true; |
236 const int parameter_count = 0; | 210 const int parameter_count = 0; |
237 const int length = kVariablePartIndex + parameter_count + | 211 const int length = kVariablePartIndex + parameter_count + |
238 (1 + stack_local_count) + 2 * context_local_count + | 212 (1 + stack_local_count) + 2 * context_local_count + |
239 2 * context_global_count + | 213 2 * context_global_count + |
240 3 * strong_mode_free_variable_count + | |
241 (has_receiver ? 1 : 0) + (has_function_name ? 2 : 0); | 214 (has_receiver ? 1 : 0) + (has_function_name ? 2 : 0); |
242 | 215 |
243 Factory* factory = isolate->factory(); | 216 Factory* factory = isolate->factory(); |
244 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); | 217 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); |
245 | 218 |
246 // Encode the flags. | 219 // Encode the flags. |
247 int flags = ScopeTypeField::encode(SCRIPT_SCOPE) | | 220 int flags = ScopeTypeField::encode(SCRIPT_SCOPE) | |
248 CallsEvalField::encode(false) | | 221 CallsEvalField::encode(false) | |
249 LanguageModeField::encode(SLOPPY) | | 222 LanguageModeField::encode(SLOPPY) | |
250 DeclarationScopeField::encode(true) | | 223 DeclarationScopeField::encode(true) | |
251 ReceiverVariableField::encode(receiver_info) | | 224 ReceiverVariableField::encode(receiver_info) | |
252 FunctionVariableField::encode(function_name_info) | | 225 FunctionVariableField::encode(function_name_info) | |
253 FunctionVariableMode::encode(function_variable_mode) | | 226 FunctionVariableMode::encode(function_variable_mode) | |
254 AsmModuleField::encode(false) | AsmFunctionField::encode(false) | | 227 AsmModuleField::encode(false) | AsmFunctionField::encode(false) | |
255 HasSimpleParametersField::encode(has_simple_parameters) | | 228 HasSimpleParametersField::encode(has_simple_parameters) | |
256 FunctionKindField::encode(FunctionKind::kNormalFunction); | 229 FunctionKindField::encode(FunctionKind::kNormalFunction); |
257 scope_info->SetFlags(flags); | 230 scope_info->SetFlags(flags); |
258 scope_info->SetParameterCount(parameter_count); | 231 scope_info->SetParameterCount(parameter_count); |
259 scope_info->SetStackLocalCount(stack_local_count); | 232 scope_info->SetStackLocalCount(stack_local_count); |
260 scope_info->SetContextLocalCount(context_local_count); | 233 scope_info->SetContextLocalCount(context_local_count); |
261 scope_info->SetContextGlobalCount(context_global_count); | 234 scope_info->SetContextGlobalCount(context_global_count); |
262 scope_info->SetStrongModeFreeVariableCount(strong_mode_free_variable_count); | |
263 | 235 |
264 int index = kVariablePartIndex; | 236 int index = kVariablePartIndex; |
265 const int first_slot_index = 0; | 237 const int first_slot_index = 0; |
266 DCHECK(index == scope_info->StackLocalFirstSlotIndex()); | 238 DCHECK(index == scope_info->StackLocalFirstSlotIndex()); |
267 scope_info->set(index++, Smi::FromInt(first_slot_index)); | 239 scope_info->set(index++, Smi::FromInt(first_slot_index)); |
268 DCHECK(index == scope_info->StackLocalEntriesIndex()); | 240 DCHECK(index == scope_info->StackLocalEntriesIndex()); |
269 | 241 |
270 // Here we add info for context-allocated "this". | 242 // Here we add info for context-allocated "this". |
271 DCHECK(index == scope_info->ContextLocalNameEntriesIndex()); | 243 DCHECK(index == scope_info->ContextLocalNameEntriesIndex()); |
272 scope_info->set(index++, *isolate->factory()->this_string()); | 244 scope_info->set(index++, *isolate->factory()->this_string()); |
273 DCHECK(index == scope_info->ContextLocalInfoEntriesIndex()); | 245 DCHECK(index == scope_info->ContextLocalInfoEntriesIndex()); |
274 const uint32_t value = ContextLocalMode::encode(CONST) | | 246 const uint32_t value = ContextLocalMode::encode(CONST) | |
275 ContextLocalInitFlag::encode(kCreatedInitialized) | | 247 ContextLocalInitFlag::encode(kCreatedInitialized) | |
276 ContextLocalMaybeAssignedFlag::encode(kNotAssigned); | 248 ContextLocalMaybeAssignedFlag::encode(kNotAssigned); |
277 scope_info->set(index++, Smi::FromInt(value)); | 249 scope_info->set(index++, Smi::FromInt(value)); |
278 | 250 |
279 DCHECK(index == scope_info->StrongModeFreeVariableNameEntriesIndex()); | |
280 DCHECK(index == scope_info->StrongModeFreeVariablePositionEntriesIndex()); | |
281 | |
282 // And here we record that this scopeinfo binds a receiver. | 251 // And here we record that this scopeinfo binds a receiver. |
283 DCHECK(index == scope_info->ReceiverEntryIndex()); | 252 DCHECK(index == scope_info->ReceiverEntryIndex()); |
284 const int receiver_index = Context::MIN_CONTEXT_SLOTS + 0; | 253 const int receiver_index = Context::MIN_CONTEXT_SLOTS + 0; |
285 scope_info->set(index++, Smi::FromInt(receiver_index)); | 254 scope_info->set(index++, Smi::FromInt(receiver_index)); |
286 | 255 |
287 DCHECK(index == scope_info->FunctionNameEntryIndex()); | 256 DCHECK(index == scope_info->FunctionNameEntryIndex()); |
288 | 257 |
289 DCHECK_EQ(index, scope_info->length()); | 258 DCHECK_EQ(index, scope_info->length()); |
290 DCHECK_EQ(scope_info->ParameterCount(), 0); | 259 DCHECK_EQ(scope_info->ParameterCount(), 0); |
291 DCHECK_EQ(scope_info->ContextLength(), Context::MIN_CONTEXT_SLOTS + 1); | 260 DCHECK_EQ(scope_info->ContextLength(), Context::MIN_CONTEXT_SLOTS + 1); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // There's currently no flag stored on the ScopeInfo to indicate that a | 444 // There's currently no flag stored on the ScopeInfo to indicate that a |
476 // variable is a compiler-introduced temporary. However, to avoid conflict | 445 // variable is a compiler-introduced temporary. However, to avoid conflict |
477 // with user declarations, the current temporaries like .generator_object and | 446 // with user declarations, the current temporaries like .generator_object and |
478 // .result start with a dot, so we can use that as a flag. It's a hack! | 447 // .result start with a dot, so we can use that as a flag. It's a hack! |
479 Handle<String> name(LocalName(var)); | 448 Handle<String> name(LocalName(var)); |
480 return (name->length() > 0 && name->Get(0) == '.') || | 449 return (name->length() > 0 && name->Get(0) == '.') || |
481 name->Equals(*GetIsolate()->factory()->this_string()); | 450 name->Equals(*GetIsolate()->factory()->this_string()); |
482 } | 451 } |
483 | 452 |
484 | 453 |
485 String* ScopeInfo::StrongModeFreeVariableName(int var) { | |
486 DCHECK(0 <= var && var < StrongModeFreeVariableCount()); | |
487 int info_index = StrongModeFreeVariableNameEntriesIndex() + var; | |
488 return String::cast(get(info_index)); | |
489 } | |
490 | |
491 | |
492 int ScopeInfo::StrongModeFreeVariableStartPosition(int var) { | |
493 DCHECK(0 <= var && var < StrongModeFreeVariableCount()); | |
494 int info_index = StrongModeFreeVariablePositionEntriesIndex() + var * 2; | |
495 int32_t value = 0; | |
496 bool ok = get(info_index)->ToInt32(&value); | |
497 USE(ok); | |
498 DCHECK(ok); | |
499 return value; | |
500 } | |
501 | |
502 | |
503 int ScopeInfo::StrongModeFreeVariableEndPosition(int var) { | |
504 DCHECK(0 <= var && var < StrongModeFreeVariableCount()); | |
505 int info_index = StrongModeFreeVariablePositionEntriesIndex() + var * 2 + 1; | |
506 int32_t value = 0; | |
507 bool ok = get(info_index)->ToInt32(&value); | |
508 USE(ok); | |
509 DCHECK(ok); | |
510 return value; | |
511 } | |
512 | |
513 | |
514 int ScopeInfo::StackSlotIndex(String* name) { | 454 int ScopeInfo::StackSlotIndex(String* name) { |
515 DCHECK(name->IsInternalizedString()); | 455 DCHECK(name->IsInternalizedString()); |
516 if (length() > 0) { | 456 if (length() > 0) { |
517 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); | 457 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); |
518 int start = StackLocalEntriesIndex(); | 458 int start = StackLocalEntriesIndex(); |
519 int end = StackLocalEntriesIndex() + StackLocalCount(); | 459 int end = StackLocalEntriesIndex() + StackLocalCount(); |
520 for (int i = start; i < end; ++i) { | 460 for (int i = start; i < end; ++i) { |
521 if (name == get(i)) { | 461 if (name == get(i)) { |
522 return i - start + first_slot_index; | 462 return i - start + first_slot_index; |
523 } | 463 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 int ScopeInfo::ContextLocalInfoEntriesIndex() { | 624 int ScopeInfo::ContextLocalInfoEntriesIndex() { |
685 return ContextGlobalNameEntriesIndex() + ContextGlobalCount(); | 625 return ContextGlobalNameEntriesIndex() + ContextGlobalCount(); |
686 } | 626 } |
687 | 627 |
688 | 628 |
689 int ScopeInfo::ContextGlobalInfoEntriesIndex() { | 629 int ScopeInfo::ContextGlobalInfoEntriesIndex() { |
690 return ContextLocalInfoEntriesIndex() + ContextLocalCount(); | 630 return ContextLocalInfoEntriesIndex() + ContextLocalCount(); |
691 } | 631 } |
692 | 632 |
693 | 633 |
694 int ScopeInfo::StrongModeFreeVariableNameEntriesIndex() { | 634 int ScopeInfo::ReceiverEntryIndex() { |
695 return ContextGlobalInfoEntriesIndex() + ContextGlobalCount(); | 635 return ContextGlobalInfoEntriesIndex() + ContextGlobalCount(); |
696 } | 636 } |
697 | 637 |
698 | 638 |
699 int ScopeInfo::StrongModeFreeVariablePositionEntriesIndex() { | |
700 return StrongModeFreeVariableNameEntriesIndex() + | |
701 StrongModeFreeVariableCount(); | |
702 } | |
703 | |
704 | |
705 int ScopeInfo::ReceiverEntryIndex() { | |
706 return StrongModeFreeVariablePositionEntriesIndex() + | |
707 2 * StrongModeFreeVariableCount(); | |
708 } | |
709 | |
710 | |
711 int ScopeInfo::FunctionNameEntryIndex() { | 639 int ScopeInfo::FunctionNameEntryIndex() { |
712 return ReceiverEntryIndex() + (HasAllocatedReceiver() ? 1 : 0); | 640 return ReceiverEntryIndex() + (HasAllocatedReceiver() ? 1 : 0); |
713 } | 641 } |
714 | 642 |
715 | 643 |
716 int ContextSlotCache::Hash(Object* data, String* name) { | 644 int ContextSlotCache::Hash(Object* data, String* name) { |
717 // Uses only lower 32 bits if pointers are larger. | 645 // Uses only lower 32 bits if pointers are larger. |
718 uintptr_t addr_hash = | 646 uintptr_t addr_hash = |
719 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(data)) >> 2; | 647 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(data)) >> 2; |
720 return static_cast<int>((addr_hash ^ name->Hash()) % kLength); | 648 return static_cast<int>((addr_hash ^ name->Hash()) % kLength); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 info->set_mode(i, var->mode()); | 777 info->set_mode(i, var->mode()); |
850 DCHECK(var->index() >= 0); | 778 DCHECK(var->index() >= 0); |
851 info->set_index(i, var->index()); | 779 info->set_index(i, var->index()); |
852 } | 780 } |
853 DCHECK(i == info->length()); | 781 DCHECK(i == info->length()); |
854 return info; | 782 return info; |
855 } | 783 } |
856 | 784 |
857 } // namespace internal | 785 } // namespace internal |
858 } // namespace v8 | 786 } // namespace v8 |
OLD | NEW |