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

Side by Side Diff: src/scopeinfo.cc

Issue 181543002: Eliminate extended mode, and other modes clean-up (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/runtime.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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const int length = kVariablePartIndex 71 const int length = kVariablePartIndex
72 + parameter_count + stack_local_count + 2 * context_local_count 72 + parameter_count + stack_local_count + 2 * context_local_count
73 + (has_function_name ? 2 : 0); 73 + (has_function_name ? 2 : 0);
74 74
75 Factory* factory = zone->isolate()->factory(); 75 Factory* factory = zone->isolate()->factory();
76 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); 76 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length);
77 77
78 // Encode the flags. 78 // Encode the flags.
79 int flags = ScopeTypeField::encode(scope->scope_type()) | 79 int flags = ScopeTypeField::encode(scope->scope_type()) |
80 CallsEvalField::encode(scope->calls_eval()) | 80 CallsEvalField::encode(scope->calls_eval()) |
81 LanguageModeField::encode(scope->language_mode()) | 81 StrictModeField::encode(scope->strict_mode()) |
82 FunctionVariableField::encode(function_name_info) | 82 FunctionVariableField::encode(function_name_info) |
83 FunctionVariableMode::encode(function_variable_mode); 83 FunctionVariableMode::encode(function_variable_mode);
84 scope_info->SetFlags(flags); 84 scope_info->SetFlags(flags);
85 scope_info->SetParameterCount(parameter_count); 85 scope_info->SetParameterCount(parameter_count);
86 scope_info->SetStackLocalCount(stack_local_count); 86 scope_info->SetStackLocalCount(stack_local_count);
87 scope_info->SetContextLocalCount(context_local_count); 87 scope_info->SetContextLocalCount(context_local_count);
88 88
89 int index = kVariablePartIndex; 89 int index = kVariablePartIndex;
90 // Add parameters. 90 // Add parameters.
91 ASSERT(index == scope_info->ParameterEntriesIndex()); 91 ASSERT(index == scope_info->ParameterEntriesIndex());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ASSERT(length() > 0); 157 ASSERT(length() > 0);
158 return ScopeTypeField::decode(Flags()); 158 return ScopeTypeField::decode(Flags());
159 } 159 }
160 160
161 161
162 bool ScopeInfo::CallsEval() { 162 bool ScopeInfo::CallsEval() {
163 return length() > 0 && CallsEvalField::decode(Flags()); 163 return length() > 0 && CallsEvalField::decode(Flags());
164 } 164 }
165 165
166 166
167 LanguageMode ScopeInfo::language_mode() { 167 StrictMode ScopeInfo::strict_mode() {
168 return length() > 0 ? LanguageModeField::decode(Flags()) : SLOPPY_MODE; 168 return length() > 0 ? StrictModeField::decode(Flags()) : SLOPPY;
169 } 169 }
170 170
171 171
172 int ScopeInfo::LocalCount() { 172 int ScopeInfo::LocalCount() {
173 return StackLocalCount() + ContextLocalCount(); 173 return StackLocalCount() + ContextLocalCount();
174 } 174 }
175 175
176 176
177 int ScopeInfo::StackSlotCount() { 177 int ScopeInfo::StackSlotCount() {
178 if (length() > 0) { 178 if (length() > 0) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 int start = scope_info->ContextLocalNameEntriesIndex(); 371 int start = scope_info->ContextLocalNameEntriesIndex();
372 int end = start + local_count; 372 int end = start + local_count;
373 for (int i = start; i < end; ++i) { 373 for (int i = start; i < end; ++i) {
374 int context_index = Context::MIN_CONTEXT_SLOTS + i - start; 374 int context_index = Context::MIN_CONTEXT_SLOTS + i - start;
375 Handle<Object> result = Runtime::SetObjectProperty( 375 Handle<Object> result = Runtime::SetObjectProperty(
376 isolate, 376 isolate,
377 scope_object, 377 scope_object,
378 Handle<String>(String::cast(scope_info->get(i))), 378 Handle<String>(String::cast(scope_info->get(i))),
379 Handle<Object>(context->get(context_index), isolate), 379 Handle<Object>(context->get(context_index), isolate),
380 ::NONE, 380 ::NONE,
381 kSloppyMode); 381 SLOPPY);
382 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, false); 382 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, false);
383 } 383 }
384 return true; 384 return true;
385 } 385 }
386 386
387 387
388 int ScopeInfo::ParameterEntriesIndex() { 388 int ScopeInfo::ParameterEntriesIndex() {
389 ASSERT(length() > 0); 389 ASSERT(length() > 0);
390 return kVariablePartIndex; 390 return kVariablePartIndex;
391 } 391 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } else { 552 } else {
553 ASSERT(var->index() >= 0); 553 ASSERT(var->index() >= 0);
554 info->set_index(i, var->index()); 554 info->set_index(i, var->index());
555 } 555 }
556 } 556 }
557 ASSERT(i == info->length()); 557 ASSERT(i == info->length());
558 return info; 558 return info;
559 } 559 }
560 560
561 } } // namespace v8::internal 561 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698