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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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()); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 Context::MIN_CONTEXT_SLOTS, | 499 Context::MIN_CONTEXT_SLOTS, |
500 ContextLocalNameEntriesIndex(), | 500 ContextLocalNameEntriesIndex(), |
501 ContextLocalNameEntriesIndex() + ContextLocalCount(), | 501 ContextLocalNameEntriesIndex() + ContextLocalCount(), |
502 this); | 502 this); |
503 | 503 |
504 PrintF("}\n"); | 504 PrintF("}\n"); |
505 } | 505 } |
506 #endif // DEBUG | 506 #endif // DEBUG |
507 | 507 |
508 } } // namespace v8::internal | 508 } } // namespace v8::internal |
OLD | NEW |