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

Side by Side Diff: src/scopes.cc

Issue 516913003: Do not expose termination exceptions to the Exception API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comment Created 6 years, 3 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') | test/cctest/test-thread-termination.cc » ('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 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/scopes.h" 7 #include "src/scopes.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 if (proxy->is_assigned()) var->set_maybe_assigned(); 1073 if (proxy->is_assigned()) var->set_maybe_assigned();
1074 1074
1075 if (FLAG_harmony_scoping && strict_mode() == STRICT && 1075 if (FLAG_harmony_scoping && strict_mode() == STRICT &&
1076 var->is_const_mode() && proxy->is_assigned()) { 1076 var->is_const_mode() && proxy->is_assigned()) {
1077 // Assignment to const. Throw a syntax error. 1077 // Assignment to const. Throw a syntax error.
1078 MessageLocation location( 1078 MessageLocation location(
1079 info->script(), proxy->position(), proxy->position()); 1079 info->script(), proxy->position(), proxy->position());
1080 Isolate* isolate = info->isolate(); 1080 Isolate* isolate = info->isolate();
1081 Factory* factory = isolate->factory(); 1081 Factory* factory = isolate->factory();
1082 Handle<JSArray> array = factory->NewJSArray(0); 1082 Handle<JSArray> array = factory->NewJSArray(0);
1083 Handle<Object> result = 1083 Handle<Object> error;
1084 MaybeHandle<Object> maybe_error =
1084 factory->NewSyntaxError("harmony_const_assign", array); 1085 factory->NewSyntaxError("harmony_const_assign", array);
1085 isolate->Throw(*result, &location); 1086 if (maybe_error.ToHandle(&error)) isolate->Throw(*error, &location);
1086 return false; 1087 return false;
1087 } 1088 }
1088 1089
1089 if (FLAG_harmony_modules) { 1090 if (FLAG_harmony_modules) {
1090 bool ok; 1091 bool ok;
1091 #ifdef DEBUG 1092 #ifdef DEBUG
1092 if (FLAG_print_interface_details) { 1093 if (FLAG_print_interface_details) {
1093 PrintF("# Resolve %.*s:\n", var->raw_name()->length(), 1094 PrintF("# Resolve %.*s:\n", var->raw_name()->length(),
1094 var->raw_name()->raw_data()); 1095 var->raw_name()->raw_data());
1095 } 1096 }
(...skipping 11 matching lines...) Expand all
1107 #endif 1108 #endif
1108 1109
1109 // Inconsistent use of module. Throw a syntax error. 1110 // Inconsistent use of module. Throw a syntax error.
1110 // TODO(rossberg): generate more helpful error message. 1111 // TODO(rossberg): generate more helpful error message.
1111 MessageLocation location( 1112 MessageLocation location(
1112 info->script(), proxy->position(), proxy->position()); 1113 info->script(), proxy->position(), proxy->position());
1113 Isolate* isolate = info->isolate(); 1114 Isolate* isolate = info->isolate();
1114 Factory* factory = isolate->factory(); 1115 Factory* factory = isolate->factory();
1115 Handle<JSArray> array = factory->NewJSArray(1); 1116 Handle<JSArray> array = factory->NewJSArray(1);
1116 JSObject::SetElement(array, 0, var->name(), NONE, STRICT).Assert(); 1117 JSObject::SetElement(array, 0, var->name(), NONE, STRICT).Assert();
1117 Handle<Object> result = 1118 Handle<Object> error;
1119 MaybeHandle<Object> maybe_error =
1118 factory->NewSyntaxError("module_type_error", array); 1120 factory->NewSyntaxError("module_type_error", array);
1119 isolate->Throw(*result, &location); 1121 if (maybe_error.ToHandle(&error)) isolate->Throw(*error, &location);
1120 return false; 1122 return false;
1121 } 1123 }
1122 } 1124 }
1123 1125
1124 proxy->BindTo(var); 1126 proxy->BindTo(var);
1125 1127
1126 return true; 1128 return true;
1127 } 1129 }
1128 1130
1129 1131
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 } 1395 }
1394 1396
1395 1397
1396 int Scope::ContextLocalCount() const { 1398 int Scope::ContextLocalCount() const {
1397 if (num_heap_slots() == 0) return 0; 1399 if (num_heap_slots() == 0) return 0;
1398 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1400 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1399 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); 1401 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0);
1400 } 1402 }
1401 1403
1402 } } // namespace v8::internal 1404 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-thread-termination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698