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

Side by Side Diff: src/runtime.js

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month 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') | src/scanner.h » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 var V = this; 368 var V = this;
369 if (!IS_SPEC_FUNCTION(F)) { 369 if (!IS_SPEC_FUNCTION(F)) {
370 throw %MakeTypeError('instanceof_function_expected', [V]); 370 throw %MakeTypeError('instanceof_function_expected', [V]);
371 } 371 }
372 372
373 // If V is not an object, return false. 373 // If V is not an object, return false.
374 if (!IS_SPEC_OBJECT(V)) { 374 if (!IS_SPEC_OBJECT(V)) {
375 return 1; 375 return 1;
376 } 376 }
377 377
378 // Check if function is bound, if so, get [[BoundFunction]] from it
379 // and use that instead of F.
380 var bindings = %BoundFunctionGetBindings(F);
381 if (bindings) {
382 F = bindings[kBoundFunctionIndex]; // Always a non-bound function.
383 }
378 // Get the prototype of F; if it is not an object, throw an error. 384 // Get the prototype of F; if it is not an object, throw an error.
379 var O = F.prototype; 385 var O = F.prototype;
380 if (!IS_SPEC_OBJECT(O)) { 386 if (!IS_SPEC_OBJECT(O)) {
381 throw %MakeTypeError('instanceof_nonobject_proto', [O]); 387 throw %MakeTypeError('instanceof_nonobject_proto', [O]);
382 } 388 }
383 389
384 // Return whether or not O is in the prototype chain of V. 390 // Return whether or not O is in the prototype chain of V.
385 return %IsInPrototypeChain(O, V) ? 0 : 1; 391 return %IsInPrototypeChain(O, V) ? 0 : 1;
386 } 392 }
387 393
388 394
389 // Get an array of property keys for the given object. Used in
390 // for-in statements.
391 function GET_KEYS() {
392 return %GetPropertyNames(this);
393 }
394
395
396 // Filter a given key against an object by checking if the object 395 // Filter a given key against an object by checking if the object
397 // has a property with the given key; return the key as a string if 396 // has a property with the given key; return the key as a string if
398 // it has. Otherwise returns 0 (smi). Used in for-in statements. 397 // it has. Otherwise returns 0 (smi). Used in for-in statements.
399 function FILTER_KEY(key) { 398 function FILTER_KEY(key) {
400 var string = %ToString(key); 399 var string = %ToString(key);
401 if (%HasProperty(this, string)) return string; 400 if (%HasProperty(this, string)) return string;
402 return 0; 401 return 0;
403 } 402 }
404 403
405 404
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // multiplying with pointer size. 455 // multiplying with pointer size.
457 if (length > 0x800000) { 456 if (length > 0x800000) {
458 throw %MakeRangeError('stack_overflow', []); 457 throw %MakeRangeError('stack_overflow', []);
459 } 458 }
460 459
461 if (!IS_SPEC_FUNCTION(this)) { 460 if (!IS_SPEC_FUNCTION(this)) {
462 throw %MakeTypeError('apply_non_function', [ %ToString(this), typeof this ]) ; 461 throw %MakeTypeError('apply_non_function', [ %ToString(this), typeof this ]) ;
463 } 462 }
464 463
465 // Make sure the arguments list has the right type. 464 // Make sure the arguments list has the right type.
466 if (args != null && !IS_ARRAY(args) && !IS_ARGUMENTS(args)) { 465 if (args != null && !IS_SPEC_OBJECT(args)) {
467 throw %MakeTypeError('apply_wrong_args', []); 466 throw %MakeTypeError('apply_wrong_args', []);
468 } 467 }
469 468
470 // Return the length which is the number of arguments to copy to the 469 // Return the length which is the number of arguments to copy to the
471 // stack. It is guaranteed to be a small integer at this point. 470 // stack. It is guaranteed to be a small integer at this point.
472 return length; 471 return length;
473 } 472 }
474 473
475 474
476 function APPLY_OVERFLOW(length) { 475 function APPLY_OVERFLOW(length) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 throw %MakeTypeError('cannot_convert_to_primitive', []); 657 throw %MakeTypeError('cannot_convert_to_primitive', []);
659 } 658 }
660 659
661 660
662 // NOTE: Setting the prototype for Array must take place as early as 661 // NOTE: Setting the prototype for Array must take place as early as
663 // possible due to code generation for array literals. When 662 // possible due to code generation for array literals. When
664 // generating code for a array literal a boilerplate array is created 663 // generating code for a array literal a boilerplate array is created
665 // that is cloned when running the code. It is essential that the 664 // that is cloned when running the code. It is essential that the
666 // boilerplate gets the right prototype. 665 // boilerplate gets the right prototype.
667 %FunctionSetPrototype($Array, new $Array(0)); 666 %FunctionSetPrototype($Array, new $Array(0));
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698