| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 Handle<Object> Factory::NewError(const char* type, | 424 Handle<Object> Factory::NewError(const char* type, |
| 425 Vector< Handle<Object> > args) { | 425 Vector< Handle<Object> > args) { |
| 426 return NewError("MakeError", type, args); | 426 return NewError("MakeError", type, args); |
| 427 } | 427 } |
| 428 | 428 |
| 429 | 429 |
| 430 Handle<Object> Factory::NewError(const char* maker, | 430 Handle<Object> Factory::NewError(const char* maker, |
| 431 const char* type, | 431 const char* type, |
| 432 Handle<JSArray> args) { | 432 Handle<JSArray> args) { |
| 433 Handle<String> make_str = Factory::LookupAsciiSymbol(maker); | 433 Handle<String> make_str = Factory::LookupAsciiSymbol(maker); |
| 434 Handle<Object> fun_obj(Top::builtins()->GetProperty(*make_str)); | 434 Handle<Object> fun_obj(Top::builtins()->GetPropertyNoExceptionThrown( |
| 435 *make_str)); |
| 435 // If the builtins haven't been properly configured yet this error | 436 // If the builtins haven't been properly configured yet this error |
| 436 // constructor may not have been defined. Bail out. | 437 // constructor may not have been defined. Bail out. |
| 437 if (!fun_obj->IsJSFunction()) | 438 if (!fun_obj->IsJSFunction()) |
| 438 return Factory::undefined_value(); | 439 return Factory::undefined_value(); |
| 439 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); | 440 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); |
| 440 Handle<Object> type_obj = Factory::LookupAsciiSymbol(type); | 441 Handle<Object> type_obj = Factory::LookupAsciiSymbol(type); |
| 441 Object** argv[2] = { type_obj.location(), | 442 Object** argv[2] = { type_obj.location(), |
| 442 Handle<Object>::cast(args).location() }; | 443 Handle<Object>::cast(args).location() }; |
| 443 | 444 |
| 444 // Invoke the JavaScript factory method. If an exception is thrown while | 445 // Invoke the JavaScript factory method. If an exception is thrown while |
| (...skipping 12 matching lines...) Expand all Loading... |
| 457 return NewError("$Error", message); | 458 return NewError("$Error", message); |
| 458 } | 459 } |
| 459 | 460 |
| 460 | 461 |
| 461 Handle<Object> Factory::NewError(const char* constructor, | 462 Handle<Object> Factory::NewError(const char* constructor, |
| 462 Handle<String> message) { | 463 Handle<String> message) { |
| 463 Handle<String> constr = Factory::LookupAsciiSymbol(constructor); | 464 Handle<String> constr = Factory::LookupAsciiSymbol(constructor); |
| 464 Handle<JSFunction> fun = | 465 Handle<JSFunction> fun = |
| 465 Handle<JSFunction>( | 466 Handle<JSFunction>( |
| 466 JSFunction::cast( | 467 JSFunction::cast( |
| 467 Top::builtins()->GetProperty(*constr))); | 468 Top::builtins()->GetPropertyNoExceptionThrown(*constr))); |
| 468 Object** argv[1] = { Handle<Object>::cast(message).location() }; | 469 Object** argv[1] = { Handle<Object>::cast(message).location() }; |
| 469 | 470 |
| 470 // Invoke the JavaScript factory method. If an exception is thrown while | 471 // Invoke the JavaScript factory method. If an exception is thrown while |
| 471 // running the factory method, use the exception as the result. | 472 // running the factory method, use the exception as the result. |
| 472 bool caught_exception; | 473 bool caught_exception; |
| 473 Handle<Object> result = Execution::TryCall(fun, | 474 Handle<Object> result = Execution::TryCall(fun, |
| 474 Top::builtins(), | 475 Top::builtins(), |
| 475 1, | 476 1, |
| 476 argv, | 477 argv, |
| 477 &caught_exception); | 478 &caught_exception); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 Handle<Code> Factory::CopyCode(Handle<Code> code) { | 561 Handle<Code> Factory::CopyCode(Handle<Code> code) { |
| 561 CALL_HEAP_FUNCTION(Heap::CopyCode(*code), Code); | 562 CALL_HEAP_FUNCTION(Heap::CopyCode(*code), Code); |
| 562 } | 563 } |
| 563 | 564 |
| 564 | 565 |
| 565 Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { | 566 Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { |
| 566 CALL_HEAP_FUNCTION(Heap::CopyCode(*code, reloc_info), Code); | 567 CALL_HEAP_FUNCTION(Heap::CopyCode(*code, reloc_info), Code); |
| 567 } | 568 } |
| 568 | 569 |
| 569 | 570 |
| 570 static inline Object* DoCopyInsert(DescriptorArray* array, | 571 MUST_USE_RESULT static inline MaybeObject* DoCopyInsert( |
| 571 String* key, | 572 DescriptorArray* array, |
| 572 Object* value, | 573 String* key, |
| 573 PropertyAttributes attributes) { | 574 Object* value, |
| 575 PropertyAttributes attributes) { |
| 574 CallbacksDescriptor desc(key, value, attributes); | 576 CallbacksDescriptor desc(key, value, attributes); |
| 575 Object* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS); | 577 MaybeObject* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS); |
| 576 return obj; | 578 return obj; |
| 577 } | 579 } |
| 578 | 580 |
| 579 | 581 |
| 580 // Allocate the new array. | 582 // Allocate the new array. |
| 581 Handle<DescriptorArray> Factory::CopyAppendProxyDescriptor( | 583 Handle<DescriptorArray> Factory::CopyAppendProxyDescriptor( |
| 582 Handle<DescriptorArray> array, | 584 Handle<DescriptorArray> array, |
| 583 Handle<String> key, | 585 Handle<String> key, |
| 584 Handle<Object> value, | 586 Handle<Object> value, |
| 585 PropertyAttributes attributes) { | 587 PropertyAttributes attributes) { |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 ASSERT(result->shared()->IsApiFunction()); | 916 ASSERT(result->shared()->IsApiFunction()); |
| 915 return result; | 917 return result; |
| 916 } | 918 } |
| 917 | 919 |
| 918 | 920 |
| 919 Handle<MapCache> Factory::NewMapCache(int at_least_space_for) { | 921 Handle<MapCache> Factory::NewMapCache(int at_least_space_for) { |
| 920 CALL_HEAP_FUNCTION(MapCache::Allocate(at_least_space_for), MapCache); | 922 CALL_HEAP_FUNCTION(MapCache::Allocate(at_least_space_for), MapCache); |
| 921 } | 923 } |
| 922 | 924 |
| 923 | 925 |
| 924 static Object* UpdateMapCacheWith(Context* context, | 926 MUST_USE_RESULT static MaybeObject* UpdateMapCacheWith(Context* context, |
| 925 FixedArray* keys, | 927 FixedArray* keys, |
| 926 Map* map) { | 928 Map* map) { |
| 927 Object* result = MapCache::cast(context->map_cache())->Put(keys, map); | 929 Object* result; |
| 928 if (!result->IsFailure()) context->set_map_cache(MapCache::cast(result)); | 930 { MaybeObject* maybe_result = |
| 931 MapCache::cast(context->map_cache())->Put(keys, map); |
| 932 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 933 } |
| 934 context->set_map_cache(MapCache::cast(result)); |
| 929 return result; | 935 return result; |
| 930 } | 936 } |
| 931 | 937 |
| 932 | 938 |
| 933 Handle<MapCache> Factory::AddToMapCache(Handle<Context> context, | 939 Handle<MapCache> Factory::AddToMapCache(Handle<Context> context, |
| 934 Handle<FixedArray> keys, | 940 Handle<FixedArray> keys, |
| 935 Handle<Map> map) { | 941 Handle<Map> map) { |
| 936 CALL_HEAP_FUNCTION(UpdateMapCacheWith(*context, *keys, *map), MapCache); | 942 CALL_HEAP_FUNCTION(UpdateMapCacheWith(*context, *keys, *map), MapCache); |
| 937 } | 943 } |
| 938 | 944 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 Execution::ConfigureInstance(instance, | 1008 Execution::ConfigureInstance(instance, |
| 1003 instance_template, | 1009 instance_template, |
| 1004 pending_exception); | 1010 pending_exception); |
| 1005 } else { | 1011 } else { |
| 1006 *pending_exception = false; | 1012 *pending_exception = false; |
| 1007 } | 1013 } |
| 1008 } | 1014 } |
| 1009 | 1015 |
| 1010 | 1016 |
| 1011 } } // namespace v8::internal | 1017 } } // namespace v8::internal |
| OLD | NEW |