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

Side by Side Diff: src/v8natives.js

Issue 8139027: Version 3.6.5 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/v8globals.h ('k') | src/version.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 return %_CallFunction(receiver, f); 186 return %_CallFunction(receiver, f);
187 } 187 }
188 188
189 189
190 // ---------------------------------------------------------------------------- 190 // ----------------------------------------------------------------------------
191 191
192 // Set up global object. 192 // Set up global object.
193 function SetUpGlobal() { 193 function SetUpGlobal() {
194 %CheckIsBootstrapping(); 194 %CheckIsBootstrapping();
195 // ECMA 262 - 15.1.1.1. 195 // ECMA 262 - 15.1.1.1.
196 %SetProperty(global, "NaN", $NaN, DONT_ENUM | DONT_DELETE); 196 %SetProperty(global, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY);
197 197
198 // ECMA-262 - 15.1.1.2. 198 // ECMA-262 - 15.1.1.2.
199 %SetProperty(global, "Infinity", 1/0, DONT_ENUM | DONT_DELETE); 199 %SetProperty(global, "Infinity", 1/0, DONT_ENUM | DONT_DELETE | READ_ONLY);
200 200
201 // ECMA-262 - 15.1.1.3. 201 // ECMA-262 - 15.1.1.3.
202 %SetProperty(global, "undefined", void 0, DONT_ENUM | DONT_DELETE); 202 %SetProperty(global, "undefined", void 0,
203 DONT_ENUM | DONT_DELETE | READ_ONLY);
203 204
204 // Set up non-enumerable function on the global object. 205 // Set up non-enumerable function on the global object.
205 InstallFunctions(global, DONT_ENUM, $Array( 206 InstallFunctions(global, DONT_ENUM, $Array(
206 "isNaN", GlobalIsNaN, 207 "isNaN", GlobalIsNaN,
207 "isFinite", GlobalIsFinite, 208 "isFinite", GlobalIsFinite,
208 "parseInt", GlobalParseInt, 209 "parseInt", GlobalParseInt,
209 "parseFloat", GlobalParseFloat, 210 "parseFloat", GlobalParseFloat,
210 "eval", GlobalEval 211 "eval", GlobalEval
211 )); 212 ));
212 } 213 }
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 1036
1036 1037
1037 // Harmony proxies. 1038 // Harmony proxies.
1038 function ProxyFix(obj) { 1039 function ProxyFix(obj) {
1039 var handler = %GetHandler(obj); 1040 var handler = %GetHandler(obj);
1040 var props = CallTrap0(handler, "fix", void 0); 1041 var props = CallTrap0(handler, "fix", void 0);
1041 if (IS_UNDEFINED(props)) { 1042 if (IS_UNDEFINED(props)) {
1042 throw MakeTypeError("handler_returned_undefined", [handler, "fix"]); 1043 throw MakeTypeError("handler_returned_undefined", [handler, "fix"]);
1043 } 1044 }
1044 1045
1045 if (IS_SPEC_FUNCTION(obj)) { 1046 if (%IsJSFunctionProxy(obj)) {
1046 var callTrap = %GetCallTrap(obj); 1047 var callTrap = %GetCallTrap(obj);
1047 var constructTrap = %GetConstructTrap(obj); 1048 var constructTrap = %GetConstructTrap(obj);
1048 var code = DelegateCallAndConstruct(callTrap, constructTrap); 1049 var code = DelegateCallAndConstruct(callTrap, constructTrap);
1049 %Fix(obj); // becomes a regular function 1050 %Fix(obj); // becomes a regular function
1050 %SetCode(obj, code); 1051 %SetCode(obj, code);
1052 // TODO(rossberg): What about length and other properties? Not specified.
1053 // We just put in some half-reasonable defaults for now.
1054 var prototype = new $Object();
1055 $Object.defineProperty(prototype, "constructor",
1056 {value: obj, writable: true, enumerable: false, configrable: true});
1057 $Object.defineProperty(obj, "prototype",
1058 {value: prototype, writable: true, enumerable: false, configrable: false})
1059 $Object.defineProperty(obj, "length",
1060 {value: 0, writable: true, enumerable: false, configrable: false});
1051 } else { 1061 } else {
1052 %Fix(obj); 1062 %Fix(obj);
1053 } 1063 }
1054 ObjectDefineProperties(obj, props); 1064 ObjectDefineProperties(obj, props);
1055 } 1065 }
1056 1066
1057 1067
1058 // ES5 section 15.2.3.8. 1068 // ES5 section 15.2.3.8.
1059 function ObjectSeal(obj) { 1069 function ObjectSeal(obj) {
1060 if (!IS_SPEC_OBJECT(obj)) { 1070 if (!IS_SPEC_OBJECT(obj)) {
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 1562
1553 function SetUpFunction() { 1563 function SetUpFunction() {
1554 %CheckIsBootstrapping(); 1564 %CheckIsBootstrapping();
1555 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1565 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1556 "bind", FunctionBind, 1566 "bind", FunctionBind,
1557 "toString", FunctionToString 1567 "toString", FunctionToString
1558 )); 1568 ));
1559 } 1569 }
1560 1570
1561 SetUpFunction(); 1571 SetUpFunction();
OLDNEW
« no previous file with comments | « src/v8globals.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698