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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // ... | 54 // ... |
55 // BUILTIN_ARG(n): Last argument | 55 // BUILTIN_ARG(n): Last argument |
56 // | 56 // |
57 // and they evaluate to undefined values if too few arguments were | 57 // and they evaluate to undefined values if too few arguments were |
58 // passed to the builtin function invocation. | 58 // passed to the builtin function invocation. |
59 // | 59 // |
60 // __argc__ is the number of arguments including the receiver. | 60 // __argc__ is the number of arguments including the receiver. |
61 // ---------------------------------------------------------------------------- | 61 // ---------------------------------------------------------------------------- |
62 | 62 |
63 | 63 |
64 // TODO(1238487): We should consider passing whether or not the | 64 // TODO(428): We should consider passing whether or not the |
65 // builtin was invoked as a constructor as part of the | 65 // builtin was invoked as a constructor as part of the |
66 // arguments. Maybe we also want to pass the called function? | 66 // arguments. Maybe we also want to pass the called function? |
67 #define BUILTIN(name) \ | 67 #define BUILTIN(name) \ |
68 static Object* Builtin_##name(int __argc__, Object** __argv__) { \ | 68 static Object* Builtin_##name(int __argc__, Object** __argv__) { \ |
69 Handle<Object> receiver(&__argv__[0]); | 69 Handle<Object> receiver(&__argv__[0]); |
70 | 70 |
71 | 71 |
72 // Use an inline function to avoid evaluating the index (n) more than | 72 // Use an inline function to avoid evaluating the index (n) more than |
73 // once in the BUILTIN_ARG macro. | 73 // once in the BUILTIN_ARG macro. |
74 static inline Object* __builtin_arg__(int n, int argc, Object** argv) { | 74 static inline Object* __builtin_arg__(int n, int argc, Object** argv) { |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 if (current == Heap::null_value()) *arg = Heap::undefined_value(); | 329 if (current == Heap::null_value()) *arg = Heap::undefined_value(); |
330 } | 330 } |
331 return holder; | 331 return holder; |
332 } | 332 } |
333 | 333 |
334 | 334 |
335 BUILTIN(HandleApiCall) { | 335 BUILTIN(HandleApiCall) { |
336 HandleScope scope; | 336 HandleScope scope; |
337 bool is_construct = CalledAsConstructor(); | 337 bool is_construct = CalledAsConstructor(); |
338 | 338 |
339 // TODO(1238487): This is not nice. We need to get rid of this | 339 // TODO(428): Remove use of static variable, handle API callbacks directly. |
340 // kludgy behavior and start handling API calls in a more direct | |
341 // way - maybe compile specialized stubs lazily?. | |
342 Handle<JSFunction> function = | 340 Handle<JSFunction> function = |
343 Handle<JSFunction>(JSFunction::cast(Builtins::builtin_passed_function)); | 341 Handle<JSFunction>(JSFunction::cast(Builtins::builtin_passed_function)); |
344 | 342 |
345 if (is_construct) { | 343 if (is_construct) { |
346 Handle<FunctionTemplateInfo> desc = | 344 Handle<FunctionTemplateInfo> desc = |
347 Handle<FunctionTemplateInfo>( | 345 Handle<FunctionTemplateInfo>( |
348 FunctionTemplateInfo::cast(function->shared()->function_data())); | 346 FunctionTemplateInfo::cast(function->shared()->function_data())); |
349 bool pending_exception = false; | 347 bool pending_exception = false; |
350 Factory::ConfigureInstance(desc, Handle<JSObject>::cast(receiver), | 348 Factory::ConfigureInstance(desc, Handle<JSObject>::cast(receiver), |
351 &pending_exception); | 349 &pending_exception); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 if (entry->contains(pc)) { | 773 if (entry->contains(pc)) { |
776 return names_[i]; | 774 return names_[i]; |
777 } | 775 } |
778 } | 776 } |
779 } | 777 } |
780 return NULL; | 778 return NULL; |
781 } | 779 } |
782 | 780 |
783 | 781 |
784 } } // namespace v8::internal | 782 } } // namespace v8::internal |
OLD | NEW |