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

Side by Side Diff: src/runtime.js

Issue 1086313003: Migrate error messages, part 2. (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/regexp.js ('k') | src/runtime/runtime-compiler.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 // This files contains runtime support implemented in JavaScript. 5 // This files contains runtime support implemented in JavaScript.
6 6
7 // CAUTION: Some of the functions specified in this file are called 7 // CAUTION: Some of the functions specified in this file are called
8 // directly from compiled code. These are the functions with names in 8 // directly from compiled code. These are the functions with names in
9 // ALL CAPS. The compiled code passes the first argument in 'this'. 9 // ALL CAPS. The compiled code passes the first argument in 'this'.
10 10
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (%HasProperty(this, string)) return string; 372 if (%HasProperty(this, string)) return string;
373 return 0; 373 return 0;
374 } 374 }
375 375
376 376
377 function CALL_NON_FUNCTION() { 377 function CALL_NON_FUNCTION() {
378 var delegate = %GetFunctionDelegate(this); 378 var delegate = %GetFunctionDelegate(this);
379 if (!IS_FUNCTION(delegate)) { 379 if (!IS_FUNCTION(delegate)) {
380 var callsite = %RenderCallSite(); 380 var callsite = %RenderCallSite();
381 if (callsite == "") callsite = typeof this; 381 if (callsite == "") callsite = typeof this;
382 throw %MakeTypeError('called_non_callable', [callsite]); 382 throw %MakeTypeError(kCalledNonCallable, callsite);
383 } 383 }
384 return %Apply(delegate, this, arguments, 0, %_ArgumentsLength()); 384 return %Apply(delegate, this, arguments, 0, %_ArgumentsLength());
385 } 385 }
386 386
387 387
388 function CALL_NON_FUNCTION_AS_CONSTRUCTOR() { 388 function CALL_NON_FUNCTION_AS_CONSTRUCTOR() {
389 var delegate = %GetConstructorDelegate(this); 389 var delegate = %GetConstructorDelegate(this);
390 if (!IS_FUNCTION(delegate)) { 390 if (!IS_FUNCTION(delegate)) {
391 var callsite = %RenderCallSite(); 391 var callsite = %RenderCallSite();
392 if (callsite == "") callsite = typeof this; 392 if (callsite == "") callsite = typeof this;
393 throw %MakeTypeError('called_non_callable', [callsite]); 393 throw %MakeTypeError(kCalledNonCallable, callsite);
394 } 394 }
395 return %Apply(delegate, this, arguments, 0, %_ArgumentsLength()); 395 return %Apply(delegate, this, arguments, 0, %_ArgumentsLength());
396 } 396 }
397 397
398 398
399 function CALL_FUNCTION_PROXY() { 399 function CALL_FUNCTION_PROXY() {
400 var arity = %_ArgumentsLength() - 1; 400 var arity = %_ArgumentsLength() - 1;
401 var proxy = %_Arguments(arity); // The proxy comes in as an additional arg. 401 var proxy = %_Arguments(arity); // The proxy comes in as an additional arg.
402 var trap = %GetCallTrap(proxy); 402 var trap = %GetCallTrap(proxy);
403 return %Apply(trap, this, arguments, 0, arity); 403 return %Apply(trap, this, arguments, 0, arity);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // that takes care of more eventualities. 456 // that takes care of more eventualities.
457 if (IS_ARRAY(args)) { 457 if (IS_ARRAY(args)) {
458 length = args.length; 458 length = args.length;
459 if (%_IsSmi(length) && length >= 0 && length < kSafeArgumentsLength && 459 if (%_IsSmi(length) && length >= 0 && length < kSafeArgumentsLength &&
460 IS_SPEC_FUNCTION(this)) { 460 IS_SPEC_FUNCTION(this)) {
461 return length; 461 return length;
462 } 462 }
463 } 463 }
464 464
465 if (!IS_SPEC_FUNCTION(this)) { 465 if (!IS_SPEC_FUNCTION(this)) {
466 throw %MakeTypeError('called_non_callable', [ %ToString(this) ]); 466 throw %MakeTypeError(kCalledNonCallable, %ToString(this));
467 } 467 }
468 468
469 if (!IS_SPEC_OBJECT(args)) { 469 if (!IS_SPEC_OBJECT(args)) {
470 throw %MakeTypeError('reflect_apply_wrong_args', [ ]); 470 throw %MakeTypeError('reflect_apply_wrong_args', [ ]);
471 } 471 }
472 472
473 length = %ToLength(args.length); 473 length = %ToLength(args.length);
474 474
475 // We can handle any number of apply arguments if the stack is 475 // We can handle any number of apply arguments if the stack is
476 // big enough, but sanity check the value to avoid overflow when 476 // big enough, but sanity check the value to avoid overflow when
(...skipping 19 matching lines...) Expand all
496 if (IS_ARRAY(args)) { 496 if (IS_ARRAY(args)) {
497 length = args.length; 497 length = args.length;
498 if (%_IsSmi(length) && length >= 0 && length < kSafeArgumentsLength && 498 if (%_IsSmi(length) && length >= 0 && length < kSafeArgumentsLength &&
499 ctorOk && newTargetOk) { 499 ctorOk && newTargetOk) {
500 return length; 500 return length;
501 } 501 }
502 } 502 }
503 503
504 if (!ctorOk) { 504 if (!ctorOk) {
505 if (!IS_SPEC_FUNCTION(this)) { 505 if (!IS_SPEC_FUNCTION(this)) {
506 throw %MakeTypeError('called_non_callable', [ %ToString(this) ]); 506 throw %MakeTypeError(kCalledNonCallable, %ToString(this));
507 } else { 507 } else {
508 throw %MakeTypeError('not_constructor', [ %ToString(this) ]); 508 throw %MakeTypeError('not_constructor', [ %ToString(this) ]);
509 } 509 }
510 } 510 }
511 511
512 if (!newTargetOk) { 512 if (!newTargetOk) {
513 if (!IS_SPEC_FUNCTION(newTarget)) { 513 if (!IS_SPEC_FUNCTION(newTarget)) {
514 throw %MakeTypeError('called_non_callable', [ %ToString(newTarget) ]); 514 throw %MakeTypeError(kCalledNonCallable, %ToString(newTarget));
515 } else { 515 } else {
516 throw %MakeTypeError('not_constructor', [ %ToString(newTarget) ]); 516 throw %MakeTypeError('not_constructor', [ %ToString(newTarget) ]);
517 } 517 }
518 } 518 }
519 519
520 if (!IS_SPEC_OBJECT(args)) { 520 if (!IS_SPEC_OBJECT(args)) {
521 throw %MakeTypeError('reflect_construct_wrong_args', [ ]); 521 throw %MakeTypeError('reflect_construct_wrong_args', [ ]);
522 } 522 }
523 523
524 length = %ToLength(args.length); 524 length = %ToLength(args.length);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 785
786 /* ----------------------------------------------- 786 /* -----------------------------------------------
787 - - - J a v a S c r i p t S t u b s - - - 787 - - - J a v a S c r i p t S t u b s - - -
788 ----------------------------------------------- 788 -----------------------------------------------
789 */ 789 */
790 790
791 function STRING_LENGTH_STUB(name) { 791 function STRING_LENGTH_STUB(name) {
792 var receiver = this; // implicit first parameter 792 var receiver = this; // implicit first parameter
793 return %_StringGetLength(%_JSValueGetValue(receiver)); 793 return %_StringGetLength(%_JSValueGetValue(receiver));
794 } 794 }
OLDNEW
« no previous file with comments | « src/regexp.js ('k') | src/runtime/runtime-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698