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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 Vector< Handle<Object> > args) { | 406 Vector< Handle<Object> > args) { |
407 return NewError("MakeError", type, args); | 407 return NewError("MakeError", type, args); |
408 } | 408 } |
409 | 409 |
410 | 410 |
411 Handle<Object> Factory::NewError(const char* maker, | 411 Handle<Object> Factory::NewError(const char* maker, |
412 const char* type, | 412 const char* type, |
413 Handle<JSArray> args) { | 413 Handle<JSArray> args) { |
414 Handle<String> make_str = Factory::LookupAsciiSymbol(maker); | 414 Handle<String> make_str = Factory::LookupAsciiSymbol(maker); |
415 Handle<Object> fun_obj( | 415 Handle<Object> fun_obj( |
416 Isolate::Current()->builtins()->GetProperty(*make_str)); | 416 Isolate::Current()->js_builtins_object()->GetProperty(*make_str)); |
417 // If the builtins haven't been properly configured yet this error | 417 // If the builtins haven't been properly configured yet this error |
418 // constructor may not have been defined. Bail out. | 418 // constructor may not have been defined. Bail out. |
419 if (!fun_obj->IsJSFunction()) | 419 if (!fun_obj->IsJSFunction()) |
420 return Factory::undefined_value(); | 420 return Factory::undefined_value(); |
421 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); | 421 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); |
422 Handle<Object> type_obj = Factory::LookupAsciiSymbol(type); | 422 Handle<Object> type_obj = Factory::LookupAsciiSymbol(type); |
423 Object** argv[2] = { type_obj.location(), | 423 Object** argv[2] = { type_obj.location(), |
424 Handle<Object>::cast(args).location() }; | 424 Handle<Object>::cast(args).location() }; |
425 | 425 |
426 // Invoke the JavaScript factory method. If an exception is thrown while | 426 // Invoke the JavaScript factory method. If an exception is thrown while |
427 // running the factory method, use the exception as the result. | 427 // running the factory method, use the exception as the result. |
428 bool caught_exception; | 428 bool caught_exception; |
429 Handle<Object> result = Execution::TryCall(fun, | 429 Handle<Object> result = Execution::TryCall(fun, |
430 Isolate::Current()->builtins(), | 430 Isolate::Current()->js_builtins_object(), 2, argv, &caught_exception); |
431 2, | |
432 argv, | |
433 &caught_exception); | |
434 return result; | 431 return result; |
435 } | 432 } |
436 | 433 |
437 | 434 |
438 Handle<Object> Factory::NewError(Handle<String> message) { | 435 Handle<Object> Factory::NewError(Handle<String> message) { |
439 return NewError("$Error", message); | 436 return NewError("$Error", message); |
440 } | 437 } |
441 | 438 |
442 | 439 |
443 Handle<Object> Factory::NewError(const char* constructor, | 440 Handle<Object> Factory::NewError(const char* constructor, |
444 Handle<String> message) { | 441 Handle<String> message) { |
445 Handle<String> constr = Factory::LookupAsciiSymbol(constructor); | 442 Handle<String> constr = Factory::LookupAsciiSymbol(constructor); |
446 Handle<JSFunction> fun = | 443 Handle<JSFunction> fun = |
447 Handle<JSFunction>( | 444 Handle<JSFunction>( |
448 JSFunction::cast( | 445 JSFunction::cast( |
449 Isolate::Current()->builtins()->GetProperty(*constr))); | 446 Isolate::Current()->js_builtins_object()->GetProperty(*constr))); |
450 Object** argv[1] = { Handle<Object>::cast(message).location() }; | 447 Object** argv[1] = { Handle<Object>::cast(message).location() }; |
451 | 448 |
452 // Invoke the JavaScript factory method. If an exception is thrown while | 449 // Invoke the JavaScript factory method. If an exception is thrown while |
453 // running the factory method, use the exception as the result. | 450 // running the factory method, use the exception as the result. |
454 bool caught_exception; | 451 bool caught_exception; |
455 Handle<Object> result = Execution::TryCall(fun, | 452 Handle<Object> result = Execution::TryCall(fun, |
456 Isolate::Current()->builtins(), | 453 Isolate::Current()->js_builtins_object(), 1, argv, &caught_exception); |
457 1, | |
458 argv, | |
459 &caught_exception); | |
460 return result; | 454 return result; |
461 } | 455 } |
462 | 456 |
463 | 457 |
464 Handle<JSFunction> Factory::NewFunction(Handle<String> name, | 458 Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
465 InstanceType type, | 459 InstanceType type, |
466 int instance_size, | 460 int instance_size, |
467 Handle<Code> code, | 461 Handle<Code> code, |
468 bool force_initial_map) { | 462 bool force_initial_map) { |
469 // Allocate the function | 463 // Allocate the function |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 | 775 |
782 | 776 |
783 Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee, | 777 Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee, |
784 int length) { | 778 int length) { |
785 CALL_HEAP_FUNCTION(HEAP->AllocateArgumentsObject(*callee, length), JSObject); | 779 CALL_HEAP_FUNCTION(HEAP->AllocateArgumentsObject(*callee, length), JSObject); |
786 } | 780 } |
787 | 781 |
788 | 782 |
789 Handle<JSFunction> Factory::CreateApiFunction( | 783 Handle<JSFunction> Factory::CreateApiFunction( |
790 Handle<FunctionTemplateInfo> obj, ApiInstanceType instance_type) { | 784 Handle<FunctionTemplateInfo> obj, ApiInstanceType instance_type) { |
791 Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::HandleApiCall)); | 785 Handle<Code> code = Handle<Code>(Isolate::Current()->builtins()->builtin( |
| 786 Builtins::HandleApiCall)); |
792 Handle<Code> construct_stub = | 787 Handle<Code> construct_stub = |
793 Handle<Code>(Builtins::builtin(Builtins::JSConstructStubApi)); | 788 Handle<Code>(Isolate::Current()->builtins()->builtin( |
| 789 Builtins::JSConstructStubApi)); |
794 | 790 |
795 int internal_field_count = 0; | 791 int internal_field_count = 0; |
796 if (!obj->instance_template()->IsUndefined()) { | 792 if (!obj->instance_template()->IsUndefined()) { |
797 Handle<ObjectTemplateInfo> instance_template = | 793 Handle<ObjectTemplateInfo> instance_template = |
798 Handle<ObjectTemplateInfo>( | 794 Handle<ObjectTemplateInfo>( |
799 ObjectTemplateInfo::cast(obj->instance_template())); | 795 ObjectTemplateInfo::cast(obj->instance_template())); |
800 internal_field_count = | 796 internal_field_count = |
801 Smi::cast(instance_template->internal_field_count())->value(); | 797 Smi::cast(instance_template->internal_field_count())->value(); |
802 } | 798 } |
803 | 799 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 Execution::ConfigureInstance(instance, | 971 Execution::ConfigureInstance(instance, |
976 instance_template, | 972 instance_template, |
977 pending_exception); | 973 pending_exception); |
978 } else { | 974 } else { |
979 *pending_exception = false; | 975 *pending_exception = false; |
980 } | 976 } |
981 } | 977 } |
982 | 978 |
983 | 979 |
984 } } // namespace v8::internal | 980 } } // namespace v8::internal |
OLD | NEW |