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

Side by Side Diff: src/runtime/runtime-scopes.cc

Issue 1130073005: Revert of Migrate error messages, part 10. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/test-serialize.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/frames-inl.h" 9 #include "src/frames-inl.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
11 #include "src/runtime/runtime-utils.h" 11 #include "src/runtime/runtime-utils.h"
12 #include "src/scopeinfo.h" 12 #include "src/scopeinfo.h"
13 #include "src/scopes.h" 13 #include "src/scopes.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 static Object* ThrowRedeclarationError(Isolate* isolate, Handle<String> name) { 18 static Object* ThrowRedeclarationError(Isolate* isolate, Handle<String> name) {
19 HandleScope scope(isolate); 19 HandleScope scope(isolate);
20 Handle<Object> args[1] = {name};
20 THROW_NEW_ERROR_RETURN_FAILURE( 21 THROW_NEW_ERROR_RETURN_FAILURE(
21 isolate, NewTypeError(MessageTemplate::kVarRedeclaration, name)); 22 isolate, NewTypeError("var_redeclaration", HandleVector(args, 1)));
22 } 23 }
23 24
24 25
25 RUNTIME_FUNCTION(Runtime_ThrowConstAssignError) { 26 RUNTIME_FUNCTION(Runtime_ThrowConstAssignError) {
26 HandleScope scope(isolate); 27 HandleScope scope(isolate);
27 THROW_NEW_ERROR_RETURN_FAILURE(isolate, 28 THROW_NEW_ERROR_RETURN_FAILURE(
28 NewTypeError(MessageTemplate::kConstAssign)); 29 isolate,
30 NewTypeError("const_assign", HandleVector<Object>(NULL, 0)));
29 } 31 }
30 32
31 33
32 // May throw a RedeclarationError. 34 // May throw a RedeclarationError.
33 static Object* DeclareGlobals(Isolate* isolate, Handle<GlobalObject> global, 35 static Object* DeclareGlobals(Isolate* isolate, Handle<GlobalObject> global,
34 Handle<String> name, Handle<Object> value, 36 Handle<String> name, Handle<Object> value,
35 PropertyAttributes attr, bool is_var, 37 PropertyAttributes attr, bool is_var,
36 bool is_const, bool is_function) { 38 bool is_const, bool is_function) {
37 Handle<ScriptContextTable> script_contexts( 39 Handle<ScriptContextTable> script_contexts(
38 global->native_context()->script_context_table()); 40 global->native_context()->script_context_table());
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 // In case of JSProxy, an exception might have been thrown. 998 // In case of JSProxy, an exception might have been thrown.
997 if (isolate->has_pending_exception()) return isolate->heap()->exception(); 999 if (isolate->has_pending_exception()) return isolate->heap()->exception();
998 1000
999 // The property was found in a context slot. 1001 // The property was found in a context slot.
1000 if (index >= 0) { 1002 if (index >= 0) {
1001 if ((attributes & READ_ONLY) == 0) { 1003 if ((attributes & READ_ONLY) == 0) {
1002 Handle<Context>::cast(holder)->set(index, *value); 1004 Handle<Context>::cast(holder)->set(index, *value);
1003 } else if (is_strict(language_mode)) { 1005 } else if (is_strict(language_mode)) {
1004 // Setting read only property in strict mode. 1006 // Setting read only property in strict mode.
1005 THROW_NEW_ERROR_RETURN_FAILURE( 1007 THROW_NEW_ERROR_RETURN_FAILURE(
1006 isolate, NewTypeError(MessageTemplate::kStrictCannotAssign, name)); 1008 isolate,
1009 NewTypeError("strict_cannot_assign", HandleVector(&name, 1)));
1007 } 1010 }
1008 return *value; 1011 return *value;
1009 } 1012 }
1010 1013
1011 // Slow case: The property is not in a context slot. It is either in a 1014 // Slow case: The property is not in a context slot. It is either in a
1012 // context extension object, a property of the subject of a with, or a 1015 // context extension object, a property of the subject of a with, or a
1013 // property of the global object. 1016 // property of the global object.
1014 Handle<JSReceiver> object; 1017 Handle<JSReceiver> object;
1015 if (attributes != ABSENT) { 1018 if (attributes != ABSENT) {
1016 // The property exists on the holder. 1019 // The property exists on the holder.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 } 1090 }
1088 1091
1089 // Handle special arguments properties. 1092 // Handle special arguments properties.
1090 if (String::Equals(isolate->factory()->length_string(), key)) { 1093 if (String::Equals(isolate->factory()->length_string(), key)) {
1091 return Smi::FromInt(n); 1094 return Smi::FromInt(n);
1092 } 1095 }
1093 if (String::Equals(isolate->factory()->callee_string(), key)) { 1096 if (String::Equals(isolate->factory()->callee_string(), key)) {
1094 JSFunction* function = frame->function(); 1097 JSFunction* function = frame->function();
1095 if (is_strict(function->shared()->language_mode())) { 1098 if (is_strict(function->shared()->language_mode())) {
1096 THROW_NEW_ERROR_RETURN_FAILURE( 1099 THROW_NEW_ERROR_RETURN_FAILURE(
1097 isolate, NewTypeError(MessageTemplate::kStrictPoisonPill)); 1100 isolate, NewTypeError("strict_arguments_callee",
1101 HandleVector<Object>(NULL, 0)));
1098 } 1102 }
1099 return function; 1103 return function;
1100 } 1104 }
1101 1105
1102 // Lookup in the initial Object.prototype object. 1106 // Lookup in the initial Object.prototype object.
1103 Handle<Object> result; 1107 Handle<Object> result;
1104 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1108 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1105 isolate, result, 1109 isolate, result,
1106 Object::GetProperty(isolate->initial_object_prototype(), key)); 1110 Object::GetProperty(isolate->initial_object_prototype(), key));
1107 return *result; 1111 return *result;
1108 } 1112 }
1109 1113
1110 1114
1111 RUNTIME_FUNCTION(Runtime_ArgumentsLength) { 1115 RUNTIME_FUNCTION(Runtime_ArgumentsLength) {
1112 SealHandleScope shs(isolate); 1116 SealHandleScope shs(isolate);
1113 DCHECK(args.length() == 0); 1117 DCHECK(args.length() == 0);
1114 JavaScriptFrameIterator it(isolate); 1118 JavaScriptFrameIterator it(isolate);
1115 JavaScriptFrame* frame = it.frame(); 1119 JavaScriptFrame* frame = it.frame();
1116 return Smi::FromInt(frame->GetArgumentsLength()); 1120 return Smi::FromInt(frame->GetArgumentsLength());
1117 } 1121 }
1118 1122
1119 1123
1120 RUNTIME_FUNCTION(Runtime_Arguments) { 1124 RUNTIME_FUNCTION(Runtime_Arguments) {
1121 SealHandleScope shs(isolate); 1125 SealHandleScope shs(isolate);
1122 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); 1126 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate);
1123 } 1127 }
1124 } 1128 }
1125 } // namespace v8::internal 1129 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698