| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 p = ReadSymbol(p, &s); | 237 p = ReadSymbol(p, &s); |
| 238 p = ReadInt(p, &m); | 238 p = ReadInt(p, &m); |
| 239 list->Add(s); | 239 list->Add(s); |
| 240 modes->Add(static_cast<Variable::Mode>(m)); | 240 modes->Add(static_cast<Variable::Mode>(m)); |
| 241 } | 241 } |
| 242 return ReadSentinel(p); | 242 return ReadSentinel(p); |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 template<class Allocator> | 246 template<class Allocator> |
| 247 ScopeInfo<Allocator>::ScopeInfo(Code* code) | 247 ScopeInfo<Allocator>::ScopeInfo(Code* code, FunctionScopeState scope_state) |
| 248 : function_name_(Factory::empty_symbol()), | 248 : function_name_(Factory::empty_symbol()), |
| 249 parameters_(4), | 249 parameters_(4), |
| 250 stack_slots_(8), | 250 stack_slots_(8), |
| 251 context_slots_(8), | 251 context_slots_(8), |
| 252 context_modes_(8) { | 252 context_modes_(8) { |
| 253 if (code == NULL || code->sinfo_size() == 0) return; | 253 if (code == NULL || code->sinfo_size() == 0) return; |
| 254 | 254 |
| 255 Object** p0 = &Memory::Object_at(code->sinfo_start()); | 255 Object** p0 = &Memory::Object_at(code->sinfo_start()); |
| 256 Object** p = p0; | 256 Object** p = p0; |
| 257 p = ReadSymbol(p, &function_name_); | 257 p = ReadSymbol(p, &function_name_); |
| 258 p = ReadBool(p, &calls_eval_); | 258 p = ReadBool(p, &calls_eval_); |
| 259 p = ReadList<Allocator>(p, &context_slots_, &context_modes_); | 259 p = ReadList<Allocator>(p, &context_slots_, &context_modes_); |
| 260 p = ReadList<Allocator>(p, ¶meters_); | 260 p = ReadList<Allocator>(p, ¶meters_); |
| 261 p = ReadList<Allocator>(p, &stack_slots_); | 261 p = ReadList<Allocator>(p, &stack_slots_); |
| 262 if (scope_state == FUNCTION_SCOPE_NOT_ENTERED) { |
| 263 // Remove all locals from scope info if we are in restarted state. |
| 264 context_slots_.Rewind(0); |
| 265 context_modes_.Rewind(0); |
| 266 stack_slots_.Rewind(0); |
| 267 } |
| 262 ASSERT((p - p0) * kPointerSize == code->sinfo_size()); | 268 ASSERT((p - p0) * kPointerSize == code->sinfo_size()); |
| 263 } | 269 } |
| 264 | 270 |
| 265 | 271 |
| 266 static inline Object** WriteInt(Object** p, int x) { | 272 static inline Object** WriteInt(Object** p, int x) { |
| 267 *p++ = Smi::FromInt(x); | 273 *p++ = Smi::FromInt(x); |
| 268 return p; | 274 return p; |
| 269 } | 275 } |
| 270 | 276 |
| 271 | 277 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 } | 658 } |
| 653 #endif // DEBUG | 659 #endif // DEBUG |
| 654 | 660 |
| 655 | 661 |
| 656 // Make sure the classes get instantiated by the template system. | 662 // Make sure the classes get instantiated by the template system. |
| 657 template class ScopeInfo<FreeStoreAllocationPolicy>; | 663 template class ScopeInfo<FreeStoreAllocationPolicy>; |
| 658 template class ScopeInfo<PreallocatedStorage>; | 664 template class ScopeInfo<PreallocatedStorage>; |
| 659 template class ScopeInfo<ZoneListAllocationPolicy>; | 665 template class ScopeInfo<ZoneListAllocationPolicy>; |
| 660 | 666 |
| 661 } } // namespace v8::internal | 667 } } // namespace v8::internal |
| OLD | NEW |