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

Side by Side Diff: src/proxy.js

Issue 27491002: Cosmetic: Add macros for NaN, undefined and Infinity to native js code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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/object-observe.js ('k') | src/regexp.js » ('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 22 matching lines...) Expand all
33 33
34 var $Proxy = new $Object(); 34 var $Proxy = new $Object();
35 35
36 // ------------------------------------------------------------------- 36 // -------------------------------------------------------------------
37 37
38 function ProxyCreate(handler, proto) { 38 function ProxyCreate(handler, proto) {
39 if (!IS_SPEC_OBJECT(handler)) 39 if (!IS_SPEC_OBJECT(handler))
40 throw MakeTypeError("handler_non_object", ["create"]) 40 throw MakeTypeError("handler_non_object", ["create"])
41 if (IS_UNDEFINED(proto)) 41 if (IS_UNDEFINED(proto))
42 proto = null 42 proto = null
43 else if (!(IS_SPEC_OBJECT(proto) || proto === null)) 43 else if (!(IS_SPEC_OBJECT(proto) || IS_NULL(proto)))
44 throw MakeTypeError("proto_non_object", ["create"]) 44 throw MakeTypeError("proto_non_object", ["create"])
45 return %CreateJSProxy(handler, proto) 45 return %CreateJSProxy(handler, proto)
46 } 46 }
47 47
48 function ProxyCreateFunction(handler, callTrap, constructTrap) { 48 function ProxyCreateFunction(handler, callTrap, constructTrap) {
49 if (!IS_SPEC_OBJECT(handler)) 49 if (!IS_SPEC_OBJECT(handler))
50 throw MakeTypeError("handler_non_object", ["create"]) 50 throw MakeTypeError("handler_non_object", ["create"])
51 if (!IS_SPEC_FUNCTION(callTrap)) 51 if (!IS_SPEC_FUNCTION(callTrap))
52 throw MakeTypeError("trap_function_expected", ["createFunction", "call"]) 52 throw MakeTypeError("trap_function_expected", ["createFunction", "call"])
53 if (IS_UNDEFINED(constructTrap)) { 53 if (IS_UNDEFINED(constructTrap)) {
54 constructTrap = DerivedConstructTrap(callTrap) 54 constructTrap = DerivedConstructTrap(callTrap)
55 } else if (IS_SPEC_FUNCTION(constructTrap)) { 55 } else if (IS_SPEC_FUNCTION(constructTrap)) {
56 // Make sure the trap receives 'undefined' as this. 56 // Make sure the trap receives 'undefined' as this.
57 var construct = constructTrap 57 var construct = constructTrap
58 constructTrap = function() { 58 constructTrap = function() {
59 return %Apply(construct, void 0, arguments, 0, %_ArgumentsLength()); 59 return %Apply(construct, UNDEFINED, arguments, 0, %_ArgumentsLength());
60 } 60 }
61 } else { 61 } else {
62 throw MakeTypeError("trap_function_expected", 62 throw MakeTypeError("trap_function_expected",
63 ["createFunction", "construct"]) 63 ["createFunction", "construct"])
64 } 64 }
65 return %CreateJSFunctionProxy( 65 return %CreateJSFunctionProxy(
66 handler, callTrap, constructTrap, $Function.prototype) 66 handler, callTrap, constructTrap, $Function.prototype)
67 } 67 }
68 68
69 69
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 function ProxyEnumerate(proxy) { 206 function ProxyEnumerate(proxy) {
207 var handler = %GetHandler(proxy) 207 var handler = %GetHandler(proxy)
208 if (IS_UNDEFINED(handler.enumerate)) { 208 if (IS_UNDEFINED(handler.enumerate)) {
209 return %Apply(DerivedEnumerateTrap, handler, [], 0, 0) 209 return %Apply(DerivedEnumerateTrap, handler, [], 0, 0)
210 } else { 210 } else {
211 return ToNameArray(handler.enumerate(), "enumerate", false) 211 return ToNameArray(handler.enumerate(), "enumerate", false)
212 } 212 }
213 } 213 }
OLDNEW
« no previous file with comments | « src/object-observe.js ('k') | src/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698