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

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

Issue 1126043004: Migrate error messages, part 10. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed and rebased 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};
21 THROW_NEW_ERROR_RETURN_FAILURE( 20 THROW_NEW_ERROR_RETURN_FAILURE(
22 isolate, NewTypeError("var_redeclaration", HandleVector(args, 1))); 21 isolate, NewTypeError(MessageTemplate::kVarRedeclaration, name));
23 } 22 }
24 23
25 24
26 RUNTIME_FUNCTION(Runtime_ThrowConstAssignError) { 25 RUNTIME_FUNCTION(Runtime_ThrowConstAssignError) {
27 HandleScope scope(isolate); 26 HandleScope scope(isolate);
28 THROW_NEW_ERROR_RETURN_FAILURE( 27 THROW_NEW_ERROR_RETURN_FAILURE(isolate,
29 isolate, 28 NewTypeError(MessageTemplate::kConstAssign));
30 NewTypeError("const_assign", HandleVector<Object>(NULL, 0)));
31 } 29 }
32 30
33 31
34 // May throw a RedeclarationError. 32 // May throw a RedeclarationError.
35 static Object* DeclareGlobals(Isolate* isolate, Handle<GlobalObject> global, 33 static Object* DeclareGlobals(Isolate* isolate, Handle<GlobalObject> global,
36 Handle<String> name, Handle<Object> value, 34 Handle<String> name, Handle<Object> value,
37 PropertyAttributes attr, bool is_var, 35 PropertyAttributes attr, bool is_var,
38 bool is_const, bool is_function) { 36 bool is_const, bool is_function) {
39 Handle<ScriptContextTable> script_contexts( 37 Handle<ScriptContextTable> script_contexts(
40 global->native_context()->script_context_table()); 38 global->native_context()->script_context_table());
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 // In case of JSProxy, an exception might have been thrown. 1010 // In case of JSProxy, an exception might have been thrown.
1013 if (isolate->has_pending_exception()) return isolate->heap()->exception(); 1011 if (isolate->has_pending_exception()) return isolate->heap()->exception();
1014 1012
1015 // The property was found in a context slot. 1013 // The property was found in a context slot.
1016 if (index >= 0) { 1014 if (index >= 0) {
1017 if ((attributes & READ_ONLY) == 0) { 1015 if ((attributes & READ_ONLY) == 0) {
1018 Handle<Context>::cast(holder)->set(index, *value); 1016 Handle<Context>::cast(holder)->set(index, *value);
1019 } else if (is_strict(language_mode)) { 1017 } else if (is_strict(language_mode)) {
1020 // Setting read only property in strict mode. 1018 // Setting read only property in strict mode.
1021 THROW_NEW_ERROR_RETURN_FAILURE( 1019 THROW_NEW_ERROR_RETURN_FAILURE(
1022 isolate, 1020 isolate, NewTypeError(MessageTemplate::kStrictCannotAssign, name));
1023 NewTypeError("strict_cannot_assign", HandleVector(&name, 1)));
1024 } 1021 }
1025 return *value; 1022 return *value;
1026 } 1023 }
1027 1024
1028 // Slow case: The property is not in a context slot. It is either in a 1025 // Slow case: The property is not in a context slot. It is either in a
1029 // context extension object, a property of the subject of a with, or a 1026 // context extension object, a property of the subject of a with, or a
1030 // property of the global object. 1027 // property of the global object.
1031 Handle<JSReceiver> object; 1028 Handle<JSReceiver> object;
1032 if (attributes != ABSENT) { 1029 if (attributes != ABSENT) {
1033 // The property exists on the holder. 1030 // The property exists on the holder.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 } 1101 }
1105 1102
1106 // Handle special arguments properties. 1103 // Handle special arguments properties.
1107 if (String::Equals(isolate->factory()->length_string(), key)) { 1104 if (String::Equals(isolate->factory()->length_string(), key)) {
1108 return Smi::FromInt(n); 1105 return Smi::FromInt(n);
1109 } 1106 }
1110 if (String::Equals(isolate->factory()->callee_string(), key)) { 1107 if (String::Equals(isolate->factory()->callee_string(), key)) {
1111 JSFunction* function = frame->function(); 1108 JSFunction* function = frame->function();
1112 if (is_strict(function->shared()->language_mode())) { 1109 if (is_strict(function->shared()->language_mode())) {
1113 THROW_NEW_ERROR_RETURN_FAILURE( 1110 THROW_NEW_ERROR_RETURN_FAILURE(
1114 isolate, NewTypeError("strict_arguments_callee", 1111 isolate, NewTypeError(MessageTemplate::kStrictPoisonPill));
1115 HandleVector<Object>(NULL, 0)));
1116 } 1112 }
1117 return function; 1113 return function;
1118 } 1114 }
1119 1115
1120 // Lookup in the initial Object.prototype object. 1116 // Lookup in the initial Object.prototype object.
1121 Handle<Object> result; 1117 Handle<Object> result;
1122 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1118 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1123 isolate, result, 1119 isolate, result,
1124 Object::GetProperty(isolate->initial_object_prototype(), key)); 1120 Object::GetProperty(isolate->initial_object_prototype(), key));
1125 return *result; 1121 return *result;
1126 } 1122 }
1127 1123
1128 1124
1129 RUNTIME_FUNCTION(Runtime_ArgumentsLength) { 1125 RUNTIME_FUNCTION(Runtime_ArgumentsLength) {
1130 SealHandleScope shs(isolate); 1126 SealHandleScope shs(isolate);
1131 DCHECK(args.length() == 0); 1127 DCHECK(args.length() == 0);
1132 JavaScriptFrameIterator it(isolate); 1128 JavaScriptFrameIterator it(isolate);
1133 JavaScriptFrame* frame = it.frame(); 1129 JavaScriptFrame* frame = it.frame();
1134 return Smi::FromInt(frame->GetArgumentsLength()); 1130 return Smi::FromInt(frame->GetArgumentsLength());
1135 } 1131 }
1136 1132
1137 1133
1138 RUNTIME_FUNCTION(Runtime_Arguments) { 1134 RUNTIME_FUNCTION(Runtime_Arguments) {
1139 SealHandleScope shs(isolate); 1135 SealHandleScope shs(isolate);
1140 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); 1136 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate);
1141 } 1137 }
1142 } 1138 }
1143 } // namespace v8::internal 1139 } // 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