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

Side by Side Diff: src/ast/scopes.cc

Issue 1507273002: Make Error.prototype.toString spec compliant; and fix various side-effect-free error printing metho… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « src/api.cc ('k') | src/contexts.h » ('j') | src/messages.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/ast/scopeinfo.h" 8 #include "src/ast/scopeinfo.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 // Otherwise, try to resolve the variable. 1147 // Otherwise, try to resolve the variable.
1148 BindingKind binding_kind; 1148 BindingKind binding_kind;
1149 Variable* var = LookupRecursive(proxy, &binding_kind, factory); 1149 Variable* var = LookupRecursive(proxy, &binding_kind, factory);
1150 1150
1151 #ifdef DEBUG 1151 #ifdef DEBUG
1152 if (info->script_is_native()) { 1152 if (info->script_is_native()) {
1153 // To avoid polluting the global object in native scripts 1153 // To avoid polluting the global object in native scripts
1154 // - Variables must not be allocated to the global scope. 1154 // - Variables must not be allocated to the global scope.
1155 CHECK_NOT_NULL(outer_scope()); 1155 CHECK_NOT_NULL(outer_scope());
1156 // - Variables must be bound locally or unallocated. 1156 // - Variables must be bound locally or unallocated.
1157 CHECK_EQ(BOUND, binding_kind); 1157 if (BOUND != binding_kind) {
1158 // The following variable name may be minified. If so, disable
1159 // minification in js2c.py for better output.
1160 Handle<String> name = proxy->raw_name()->string();
1161 V8_Fatal(__FILE__, __LINE__, "Unbound variable: '%s' in native script.",
1162 name->ToCString().get());
1163 }
1158 VariableLocation location = var->location(); 1164 VariableLocation location = var->location();
1159 CHECK(location == VariableLocation::LOCAL || 1165 CHECK(location == VariableLocation::LOCAL ||
1160 location == VariableLocation::CONTEXT || 1166 location == VariableLocation::CONTEXT ||
1161 location == VariableLocation::PARAMETER || 1167 location == VariableLocation::PARAMETER ||
1162 location == VariableLocation::UNALLOCATED); 1168 location == VariableLocation::UNALLOCATED);
1163 } 1169 }
1164 #endif 1170 #endif
1165 1171
1166 switch (binding_kind) { 1172 switch (binding_kind) {
1167 case BOUND: 1173 case BOUND:
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 function_ != NULL && function_->proxy()->var()->IsContextSlot(); 1656 function_ != NULL && function_->proxy()->var()->IsContextSlot();
1651 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1657 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1652 (is_function_var_in_context ? 1 : 0); 1658 (is_function_var_in_context ? 1 : 0);
1653 } 1659 }
1654 1660
1655 1661
1656 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1662 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1657 1663
1658 } // namespace internal 1664 } // namespace internal
1659 } // namespace v8 1665 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/contexts.h » ('j') | src/messages.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698