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

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

Issue 1089303003: Migrate error messages, part 3 (runtime.js). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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.js ('k') | src/symbol.js » ('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/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/messages.h"
10 #include "src/runtime/runtime.h" 11 #include "src/runtime/runtime.h"
11 #include "src/runtime/runtime-utils.h" 12 #include "src/runtime/runtime-utils.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 16
16 // Returns a single character string where first character equals 17 // Returns a single character string where first character equals
17 // string->Get(index). 18 // string->Get(index).
18 static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) { 19 static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) {
19 if (index < static_cast<uint32_t>(string->length())) { 20 if (index < static_cast<uint32_t>(string->length())) {
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 return *isolate->factory()->NewHeapNumber(0); 1202 return *isolate->factory()->NewHeapNumber(0);
1202 } 1203 }
1203 1204
1204 1205
1205 static Object* Runtime_NewObjectHelper(Isolate* isolate, 1206 static Object* Runtime_NewObjectHelper(Isolate* isolate,
1206 Handle<Object> constructor, 1207 Handle<Object> constructor,
1207 Handle<Object> original_constructor, 1208 Handle<Object> original_constructor,
1208 Handle<AllocationSite> site) { 1209 Handle<AllocationSite> site) {
1209 // If the constructor isn't a proper function we throw a type error. 1210 // If the constructor isn't a proper function we throw a type error.
1210 if (!constructor->IsJSFunction()) { 1211 if (!constructor->IsJSFunction()) {
1211 Vector<Handle<Object> > arguments = HandleVector(&constructor, 1); 1212 THROW_NEW_ERROR_RETURN_FAILURE(
1212 THROW_NEW_ERROR_RETURN_FAILURE(isolate, 1213 isolate, NewTypeError(MessageTemplate::kNotConstructor, constructor));
1213 NewTypeError("not_constructor", arguments));
1214 } 1214 }
1215 1215
1216 Handle<JSFunction> function = Handle<JSFunction>::cast(constructor); 1216 Handle<JSFunction> function = Handle<JSFunction>::cast(constructor);
1217 1217
1218 CHECK(original_constructor->IsJSFunction()); 1218 CHECK(original_constructor->IsJSFunction());
1219 Handle<JSFunction> original_function = 1219 Handle<JSFunction> original_function =
1220 Handle<JSFunction>::cast(original_constructor); 1220 Handle<JSFunction>::cast(original_constructor);
1221 1221
1222 1222
1223 // If function should not have prototype, construction is not allowed. In this 1223 // If function should not have prototype, construction is not allowed. In this
1224 // case generated code bailouts here, since function has no initial_map. 1224 // case generated code bailouts here, since function has no initial_map.
1225 if (!function->should_have_prototype() && !function->shared()->bound()) { 1225 if (!function->should_have_prototype() && !function->shared()->bound()) {
1226 Vector<Handle<Object> > arguments = HandleVector(&constructor, 1); 1226 THROW_NEW_ERROR_RETURN_FAILURE(
1227 THROW_NEW_ERROR_RETURN_FAILURE(isolate, 1227 isolate, NewTypeError(MessageTemplate::kNotConstructor, constructor));
1228 NewTypeError("not_constructor", arguments));
1229 } 1228 }
1230 1229
1231 Debug* debug = isolate->debug(); 1230 Debug* debug = isolate->debug();
1232 // Handle stepping into constructors if step into is active. 1231 // Handle stepping into constructors if step into is active.
1233 if (debug->StepInActive()) { 1232 if (debug->StepInActive()) {
1234 debug->HandleStepIn(function, Handle<Object>::null(), 0, true); 1233 debug->HandleStepIn(function, Handle<Object>::null(), 0, true);
1235 } 1234 }
1236 1235
1237 if (function->has_initial_map()) { 1236 if (function->has_initial_map()) {
1238 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) { 1237 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) {
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); 1595 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
1597 1596
1598 RETURN_FAILURE_ON_EXCEPTION( 1597 RETURN_FAILURE_ON_EXCEPTION(
1599 isolate, 1598 isolate,
1600 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), 1599 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
1601 setter, attrs)); 1600 setter, attrs));
1602 return isolate->heap()->undefined_value(); 1601 return isolate->heap()->undefined_value();
1603 } 1602 }
1604 } 1603 }
1605 } // namespace v8::internal 1604 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.js ('k') | src/symbol.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698