| OLD | NEW |
| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 } | 424 } |
| 425 | 425 |
| 426 | 426 |
| 427 MUST_USE_RESULT static MaybeObject* CallJsBuiltin( | 427 MUST_USE_RESULT static MaybeObject* CallJsBuiltin( |
| 428 Isolate* isolate, | 428 Isolate* isolate, |
| 429 const char* name, | 429 const char* name, |
| 430 BuiltinArguments<NO_EXTRA_ARGUMENTS> args) { | 430 BuiltinArguments<NO_EXTRA_ARGUMENTS> args) { |
| 431 HandleScope handleScope(isolate); | 431 HandleScope handleScope(isolate); |
| 432 | 432 |
| 433 Handle<Object> js_builtin = | 433 Handle<Object> js_builtin = |
| 434 GetProperty(Handle<JSObject>( | 434 GetProperty(Handle<JSObject>(isolate->global_context()->builtins()), |
| 435 isolate->global_context()->builtins()), | 435 name); |
| 436 name); | 436 Handle<JSFunction> function = Handle<JSFunction>::cast(js_builtin); |
| 437 ASSERT(js_builtin->IsJSFunction()); | 437 int argc = args.length() - 1; |
| 438 Handle<JSFunction> function(Handle<JSFunction>::cast(js_builtin)); | 438 ScopedVector<Handle<Object> > argv(argc); |
| 439 ScopedVector<Object**> argv(args.length() - 1); | 439 for (int i = 0; i < argc; ++i) { |
| 440 int n_args = args.length() - 1; | 440 argv[i] = args.at<Object>(i + 1); |
| 441 for (int i = 0; i < n_args; i++) { | |
| 442 argv[i] = args.at<Object>(i + 1).location(); | |
| 443 } | 441 } |
| 444 bool pending_exception; | 442 bool pending_exception; |
| 445 Handle<Object> result = Execution::Call(function, | 443 Handle<Object> result = Execution::Call(function, |
| 446 args.receiver(), | 444 args.receiver(), |
| 447 n_args, | 445 argc, |
| 448 argv.start(), | 446 argv.start(), |
| 449 &pending_exception); | 447 &pending_exception); |
| 450 if (pending_exception) return Failure::Exception(); | 448 if (pending_exception) return Failure::Exception(); |
| 451 return *result; | 449 return *result; |
| 452 } | 450 } |
| 453 | 451 |
| 454 | 452 |
| 455 BUILTIN(ArrayPush) { | 453 BUILTIN(ArrayPush) { |
| 456 Heap* heap = isolate->heap(); | 454 Heap* heap = isolate->heap(); |
| 457 Object* receiver = *args.receiver(); | 455 Object* receiver = *args.receiver(); |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 return Handle<Code>(code_address); \ | 1759 return Handle<Code>(code_address); \ |
| 1762 } | 1760 } |
| 1763 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1761 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1764 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1762 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1765 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1763 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1766 #undef DEFINE_BUILTIN_ACCESSOR_C | 1764 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1767 #undef DEFINE_BUILTIN_ACCESSOR_A | 1765 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1768 | 1766 |
| 1769 | 1767 |
| 1770 } } // namespace v8::internal | 1768 } } // namespace v8::internal |
| OLD | NEW |