Chromium Code Reviews| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 Handle<SerializedScopeInfo> scope_info) | 150 Handle<SerializedScopeInfo> scope_info) |
| 151 : isolate_(Isolate::Current()), | 151 : isolate_(Isolate::Current()), |
| 152 inner_scopes_(4), | 152 inner_scopes_(4), |
| 153 variables_(), | 153 variables_(), |
| 154 temps_(4), | 154 temps_(4), |
| 155 params_(4), | 155 params_(4), |
| 156 unresolved_(16), | 156 unresolved_(16), |
| 157 decls_(4), | 157 decls_(4), |
| 158 already_resolved_(true) { | 158 already_resolved_(true) { |
| 159 SetDefaults(type, NULL, scope_info); | 159 SetDefaults(type, NULL, scope_info); |
| 160 if (!scope_info.is_null() && scope_info->HasHeapAllocatedLocals()) { | 160 if (!scope_info.is_null()) { |
| 161 num_heap_slots_ = scope_info_->NumberOfContextSlots(); | 161 if (scope_info->HasHeapAllocatedLocals()) { |
| 162 num_heap_slots_ = scope_info_->NumberOfContextSlots(); | |
| 163 } | |
| 164 source_beg_statement_pos_ = scope_info_->SourceBegStatementPos(); | |
| 165 source_end_statement_pos_ = scope_info_->SourceEndStatementPos(); | |
| 162 } | 166 } |
| 163 AddInnerScope(inner_scope); | 167 AddInnerScope(inner_scope); |
| 164 } | 168 } |
| 165 | 169 |
| 166 | 170 |
| 167 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name) | 171 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name) |
| 168 : isolate_(Isolate::Current()), | 172 : isolate_(Isolate::Current()), |
| 169 inner_scopes_(1), | 173 inner_scopes_(1), |
| 170 variables_(), | 174 variables_(), |
| 171 temps_(0), | 175 temps_(0), |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 201 scope_calls_eval_ = false; | 205 scope_calls_eval_ = false; |
| 202 // Inherit the strict mode from the parent scope. | 206 // Inherit the strict mode from the parent scope. |
| 203 strict_mode_ = (outer_scope != NULL) && outer_scope->strict_mode_; | 207 strict_mode_ = (outer_scope != NULL) && outer_scope->strict_mode_; |
| 204 outer_scope_calls_non_strict_eval_ = false; | 208 outer_scope_calls_non_strict_eval_ = false; |
| 205 inner_scope_calls_eval_ = false; | 209 inner_scope_calls_eval_ = false; |
| 206 force_eager_compilation_ = false; | 210 force_eager_compilation_ = false; |
| 207 num_var_or_const_ = 0; | 211 num_var_or_const_ = 0; |
| 208 num_stack_slots_ = 0; | 212 num_stack_slots_ = 0; |
| 209 num_heap_slots_ = 0; | 213 num_heap_slots_ = 0; |
| 210 scope_info_ = scope_info; | 214 scope_info_ = scope_info; |
| 215 source_beg_statement_pos_ = RelocInfo::kNoPosition; | |
|
Kevin Millikin (Chromium)
2011/10/05 08:43:36
You could consider setting positions for all scope
Steven
2011/10/06 19:09:27
It is set for all scopes during initial parsing, b
| |
| 216 source_end_statement_pos_ = RelocInfo::kNoPosition; | |
| 211 } | 217 } |
| 212 | 218 |
| 213 | 219 |
| 214 Scope* Scope::DeserializeScopeChain(CompilationInfo* info, | 220 Scope* Scope::DeserializeScopeChain(CompilationInfo* info, |
| 215 Scope* global_scope) { | 221 Scope* global_scope) { |
| 216 // Reconstruct the outer scope chain from a closure's context chain. | 222 // Reconstruct the outer scope chain from a closure's context chain. |
| 217 ASSERT(!info->closure().is_null()); | 223 ASSERT(!info->closure().is_null()); |
| 218 Context* context = info->closure()->context(); | 224 Context* context = info->closure()->context(); |
| 219 Scope* current_scope = NULL; | 225 Scope* current_scope = NULL; |
| 220 Scope* innermost_scope = NULL; | 226 Scope* innermost_scope = NULL; |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1138 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && | 1144 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && |
| 1139 !must_have_local_context) { | 1145 !must_have_local_context) { |
| 1140 num_heap_slots_ = 0; | 1146 num_heap_slots_ = 0; |
| 1141 } | 1147 } |
| 1142 | 1148 |
| 1143 // Allocation done. | 1149 // Allocation done. |
| 1144 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); | 1150 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); |
| 1145 } | 1151 } |
| 1146 | 1152 |
| 1147 } } // namespace v8::internal | 1153 } } // namespace v8::internal |
| OLD | NEW |