| OLD | NEW | 
|---|
| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 523 // ECMA-262, section 9.8, page 35. | 523 // ECMA-262, section 9.8, page 35. | 
| 524 function ToString(x) { | 524 function ToString(x) { | 
| 525   if (IS_STRING(x)) return x; | 525   if (IS_STRING(x)) return x; | 
| 526   if (IS_NUMBER(x)) return %_NumberToString(x); | 526   if (IS_NUMBER(x)) return %_NumberToString(x); | 
| 527   if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; | 527   if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; | 
| 528   if (IS_UNDEFINED(x)) return 'undefined'; | 528   if (IS_UNDEFINED(x)) return 'undefined'; | 
| 529   return (IS_NULL(x)) ? 'null' : %ToString(%DefaultString(x)); | 529   return (IS_NULL(x)) ? 'null' : %ToString(%DefaultString(x)); | 
| 530 } | 530 } | 
| 531 | 531 | 
| 532 function NonStringToString(x) { | 532 function NonStringToString(x) { | 
| 533   if (IS_NUMBER(x)) return %NumberToString(x); | 533   if (IS_NUMBER(x)) return %_NumberToString(x); | 
| 534   if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; | 534   if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; | 
| 535   if (IS_UNDEFINED(x)) return 'undefined'; | 535   if (IS_UNDEFINED(x)) return 'undefined'; | 
| 536   return (IS_NULL(x)) ? 'null' : %ToString(%DefaultString(x)); | 536   return (IS_NULL(x)) ? 'null' : %ToString(%DefaultString(x)); | 
| 537 } | 537 } | 
| 538 | 538 | 
| 539 | 539 | 
| 540 // ECMA-262, section 9.9, page 36. | 540 // ECMA-262, section 9.9, page 36. | 
| 541 function ToObject(x) { | 541 function ToObject(x) { | 
| 542   if (IS_STRING(x)) return new $String(x); | 542   if (IS_STRING(x)) return new $String(x); | 
| 543   if (IS_NUMBER(x)) return new $Number(x); | 543   if (IS_NUMBER(x)) return new $Number(x); | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 639   throw %MakeTypeError('cannot_convert_to_primitive', []); | 639   throw %MakeTypeError('cannot_convert_to_primitive', []); | 
| 640 } | 640 } | 
| 641 | 641 | 
| 642 | 642 | 
| 643 // NOTE: Setting the prototype for Array must take place as early as | 643 // NOTE: Setting the prototype for Array must take place as early as | 
| 644 // possible due to code generation for array literals.  When | 644 // possible due to code generation for array literals.  When | 
| 645 // generating code for a array literal a boilerplate array is created | 645 // generating code for a array literal a boilerplate array is created | 
| 646 // that is cloned when running the code.  It is essiential that the | 646 // that is cloned when running the code.  It is essiential that the | 
| 647 // boilerplate gets the right prototype. | 647 // boilerplate gets the right prototype. | 
| 648 %FunctionSetPrototype($Array, new $Array(0)); | 648 %FunctionSetPrototype($Array, new $Array(0)); | 
| OLD | NEW | 
|---|