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

Side by Side Diff: src/scopeinfo.cc

Issue 10105026: Version 3.10.3 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 8 months 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/scanner.cc ('k') | src/scopes.h » ('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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const int stack_local_count = stack_locals.length(); 46 const int stack_local_count = stack_locals.length();
47 const int context_local_count = context_locals.length(); 47 const int context_local_count = context_locals.length();
48 // Make sure we allocate the correct amount. 48 // Make sure we allocate the correct amount.
49 ASSERT(scope->StackLocalCount() == stack_local_count); 49 ASSERT(scope->StackLocalCount() == stack_local_count);
50 ASSERT(scope->ContextLocalCount() == context_local_count); 50 ASSERT(scope->ContextLocalCount() == context_local_count);
51 51
52 // Determine use and location of the function variable if it is present. 52 // Determine use and location of the function variable if it is present.
53 FunctionVariableInfo function_name_info; 53 FunctionVariableInfo function_name_info;
54 VariableMode function_variable_mode; 54 VariableMode function_variable_mode;
55 if (scope->is_function_scope() && scope->function() != NULL) { 55 if (scope->is_function_scope() && scope->function() != NULL) {
56 Variable* var = scope->function()->var(); 56 Variable* var = scope->function()->proxy()->var();
57 if (!var->is_used()) { 57 if (!var->is_used()) {
58 function_name_info = UNUSED; 58 function_name_info = UNUSED;
59 } else if (var->IsContextSlot()) { 59 } else if (var->IsContextSlot()) {
60 function_name_info = CONTEXT; 60 function_name_info = CONTEXT;
61 } else { 61 } else {
62 ASSERT(var->IsStackLocal()); 62 ASSERT(var->IsStackLocal());
63 function_name_info = STACK; 63 function_name_info = STACK;
64 } 64 }
65 function_variable_mode = var->mode(); 65 function_variable_mode = var->mode();
66 } else { 66 } else {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 for (int i = 0; i < context_local_count; ++i) { 122 for (int i = 0; i < context_local_count; ++i) {
123 Variable* var = context_locals[i]; 123 Variable* var = context_locals[i];
124 uint32_t value = ContextLocalMode::encode(var->mode()) | 124 uint32_t value = ContextLocalMode::encode(var->mode()) |
125 ContextLocalInitFlag::encode(var->initialization_flag()); 125 ContextLocalInitFlag::encode(var->initialization_flag());
126 scope_info->set(index++, Smi::FromInt(value)); 126 scope_info->set(index++, Smi::FromInt(value));
127 } 127 }
128 128
129 // If present, add the function variable name and its index. 129 // If present, add the function variable name and its index.
130 ASSERT(index == scope_info->FunctionNameEntryIndex()); 130 ASSERT(index == scope_info->FunctionNameEntryIndex());
131 if (has_function_name) { 131 if (has_function_name) {
132 int var_index = scope->function()->var()->index(); 132 int var_index = scope->function()->proxy()->var()->index();
133 scope_info->set(index++, *scope->function()->name()); 133 scope_info->set(index++, *scope->function()->proxy()->name());
134 scope_info->set(index++, Smi::FromInt(var_index)); 134 scope_info->set(index++, Smi::FromInt(var_index));
135 ASSERT(function_name_info != STACK || 135 ASSERT(function_name_info != STACK ||
136 (var_index == scope_info->StackLocalCount() && 136 (var_index == scope_info->StackLocalCount() &&
137 var_index == scope_info->StackSlotCount() - 1)); 137 var_index == scope_info->StackSlotCount() - 1));
138 ASSERT(function_name_info != CONTEXT || 138 ASSERT(function_name_info != CONTEXT ||
139 var_index == scope_info->ContextLength() - 1); 139 var_index == scope_info->ContextLength() - 1);
140 } 140 }
141 141
142 ASSERT(index == scope_info->length()); 142 ASSERT(index == scope_info->length());
143 ASSERT(scope->num_parameters() == scope_info->ParameterCount()); 143 ASSERT(scope->num_parameters() == scope_info->ParameterCount());
144 ASSERT(scope->num_stack_slots() == scope_info->StackSlotCount()); 144 ASSERT(scope->num_stack_slots() == scope_info->StackSlotCount());
145 ASSERT(scope->num_heap_slots() == scope_info->ContextLength()); 145 ASSERT(scope->num_heap_slots() == scope_info->ContextLength() ||
146 (scope->num_heap_slots() == kVariablePartIndex &&
147 scope_info->ContextLength() == 0));
146 return scope_info; 148 return scope_info;
147 } 149 }
148 150
149 151
150 ScopeInfo* ScopeInfo::Empty() { 152 ScopeInfo* ScopeInfo::Empty() {
151 return reinterpret_cast<ScopeInfo*>(HEAP->empty_fixed_array()); 153 return reinterpret_cast<ScopeInfo*>(HEAP->empty_fixed_array());
152 } 154 }
153 155
154 156
155 ScopeType ScopeInfo::Type() { 157 ScopeType ScopeInfo::Type() {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 Context::MIN_CONTEXT_SLOTS, 501 Context::MIN_CONTEXT_SLOTS,
500 ContextLocalNameEntriesIndex(), 502 ContextLocalNameEntriesIndex(),
501 ContextLocalNameEntriesIndex() + ContextLocalCount(), 503 ContextLocalNameEntriesIndex() + ContextLocalCount(),
502 this); 504 this);
503 505
504 PrintF("}\n"); 506 PrintF("}\n");
505 } 507 }
506 #endif // DEBUG 508 #endif // DEBUG
507 509
508 } } // namespace v8::internal 510 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scanner.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698