OLD | NEW |
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 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 8230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8241 // called using 'new' and creates a new JSFunction object that | 8241 // called using 'new' and creates a new JSFunction object that |
8242 // is returned. The receiver object is only used for error | 8242 // is returned. The receiver object is only used for error |
8243 // reporting if an error occurs when constructing the new | 8243 // reporting if an error occurs when constructing the new |
8244 // JSFunction. Factory::NewJSObject() should not be used to | 8244 // JSFunction. Factory::NewJSObject() should not be used to |
8245 // allocate JSFunctions since it does not properly initialize | 8245 // allocate JSFunctions since it does not properly initialize |
8246 // the shared part of the function. Since the receiver is | 8246 // the shared part of the function. Since the receiver is |
8247 // ignored anyway, we use the global object as the receiver | 8247 // ignored anyway, we use the global object as the receiver |
8248 // instead of a new JSFunction object. This way, errors are | 8248 // instead of a new JSFunction object. This way, errors are |
8249 // reported the same way whether or not 'Function' is called | 8249 // reported the same way whether or not 'Function' is called |
8250 // using 'new'. | 8250 // using 'new'. |
8251 return isolate->context()->global_object(); | 8251 return isolate->context()->global_proxy(); |
8252 } | 8252 } |
8253 } | 8253 } |
8254 | 8254 |
8255 // The function should be compiled for the optimization hints to be | 8255 // The function should be compiled for the optimization hints to be |
8256 // available. | 8256 // available. |
8257 Compiler::EnsureCompiled(function, CLEAR_EXCEPTION); | 8257 Compiler::EnsureCompiled(function, CLEAR_EXCEPTION); |
8258 | 8258 |
8259 Handle<JSObject> result; | 8259 Handle<JSObject> result; |
8260 if (site.is_null()) { | 8260 if (site.is_null()) { |
8261 result = isolate->factory()->NewJSObject(function); | 8261 result = isolate->factory()->NewJSObject(function); |
(...skipping 6851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15113 } | 15113 } |
15114 return NULL; | 15114 return NULL; |
15115 } | 15115 } |
15116 | 15116 |
15117 | 15117 |
15118 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15118 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15119 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15119 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15120 } | 15120 } |
15121 | 15121 |
15122 } } // namespace v8::internal | 15122 } } // namespace v8::internal |
OLD | NEW |