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

Side by Side Diff: src/v8natives.js

Issue 1400973002: Throw when calling an undefined function Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ---------------------------------------------------------------------------- 9 // ----------------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 var global_proxy = %GlobalProxy(GlobalEval); 102 var global_proxy = %GlobalProxy(GlobalEval);
103 103
104 var f = %CompileString(x, false); 104 var f = %CompileString(x, false);
105 if (!IS_FUNCTION(f)) return f; 105 if (!IS_FUNCTION(f)) return f;
106 106
107 return %_CallFunction(global_proxy, f); 107 return %_CallFunction(global_proxy, f);
108 } 108 }
109 109
110 110
111 function GlobalThrowLittleDan() {
112 throw "LittleDan!"
113 }
114
115
111 // ---------------------------------------------------------------------------- 116 // ----------------------------------------------------------------------------
112 117
113 // Set up global object. 118 // Set up global object.
114 var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY; 119 var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY;
115 120
116 utils.InstallConstants(global, [ 121 utils.InstallConstants(global, [
117 // ECMA 262 - 15.1.1.1. 122 // ECMA 262 - 15.1.1.1.
118 "NaN", NAN, 123 "NaN", NAN,
119 // ECMA-262 - 15.1.1.2. 124 // ECMA-262 - 15.1.1.2.
120 "Infinity", INFINITY, 125 "Infinity", INFINITY,
121 // ECMA-262 - 15.1.1.2. 126 // ECMA-262 - 15.1.1.2.
122 "undefined", UNDEFINED, 127 "undefined", UNDEFINED,
123 ]); 128 ]);
124 129
125 // Set up non-enumerable function on the global object. 130 // Set up non-enumerable function on the global object.
126 utils.InstallFunctions(global, DONT_ENUM, [ 131 utils.InstallFunctions(global, DONT_ENUM, [
127 "isNaN", GlobalIsNaN, 132 "isNaN", GlobalIsNaN,
128 "isFinite", GlobalIsFinite, 133 "isFinite", GlobalIsFinite,
129 "parseInt", GlobalParseInt, 134 "parseInt", GlobalParseInt,
130 "parseFloat", GlobalParseFloat, 135 "parseFloat", GlobalParseFloat,
131 "eval", GlobalEval 136 "eval", GlobalEval,
137 "throwLittleDan", GlobalThrowLittleDan
132 ]); 138 ]);
133 139
134 140
135 // ---------------------------------------------------------------------------- 141 // ----------------------------------------------------------------------------
136 // Object 142 // Object
137 143
138 // ECMA-262 - 15.2.4.2 144 // ECMA-262 - 15.2.4.2
139 function ObjectToString() { 145 function ObjectToString() {
140 if (IS_UNDEFINED(this)) return "[object Undefined]"; 146 if (IS_UNDEFINED(this)) return "[object Undefined]";
141 if (IS_NULL(this)) return "[object Null]"; 147 if (IS_NULL(this)) return "[object Null]";
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 %InstallToContext([ 1848 %InstallToContext([
1843 "global_eval_fun", GlobalEval, 1849 "global_eval_fun", GlobalEval,
1844 "object_value_of", ObjectValueOf, 1850 "object_value_of", ObjectValueOf,
1845 "object_to_string", ObjectToString, 1851 "object_to_string", ObjectToString,
1846 "object_define_own_property", DefineOwnPropertyFromAPI, 1852 "object_define_own_property", DefineOwnPropertyFromAPI,
1847 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, 1853 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor,
1848 "to_complete_property_descriptor", ToCompletePropertyDescriptor, 1854 "to_complete_property_descriptor", ToCompletePropertyDescriptor,
1849 ]); 1855 ]);
1850 1856
1851 }) 1857 })
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698