| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 array->set_elements(elements); | 1843 array->set_elements(elements); |
| 1844 array->set_length(Smi::FromInt(elements_count)); | 1844 array->set_length(Smi::FromInt(elements_count)); |
| 1845 // Write in-object properties after the length of the array. | 1845 // Write in-object properties after the length of the array. |
| 1846 array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]); | 1846 array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]); |
| 1847 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]); | 1847 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]); |
| 1848 return array; | 1848 return array; |
| 1849 } | 1849 } |
| 1850 | 1850 |
| 1851 | 1851 |
| 1852 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { | 1852 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { |
| 1853 AssertNoAllocation no_alloc; | |
| 1854 ASSERT(args.length() == 5); | 1853 ASSERT(args.length() == 5); |
| 1855 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); | 1854 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); |
| 1856 CONVERT_ARG_CHECKED(String, source, 1); | 1855 CONVERT_ARG_CHECKED(String, source, 1); |
| 1856 // The no_alloc scope must begin after the above checks because they can |
| 1857 // throw and the throw can allocate to build the message. |
| 1858 AssertNoAllocation no_alloc; |
| 1857 // If source is the empty string we set it to "(?:)" instead as | 1859 // If source is the empty string we set it to "(?:)" instead as |
| 1858 // suggested by ECMA-262, 5th, section 15.10.4.1. | 1860 // suggested by ECMA-262, 5th, section 15.10.4.1. |
| 1859 if (source->length() == 0) source = isolate->heap()->query_colon_symbol(); | 1861 if (source->length() == 0) source = isolate->heap()->query_colon_symbol(); |
| 1860 | 1862 |
| 1861 Object* global = args[2]; | 1863 Object* global = args[2]; |
| 1862 if (!global->IsTrue()) global = isolate->heap()->false_value(); | 1864 if (!global->IsTrue()) global = isolate->heap()->false_value(); |
| 1863 | 1865 |
| 1864 Object* ignoreCase = args[3]; | 1866 Object* ignoreCase = args[3]; |
| 1865 if (!ignoreCase->IsTrue()) ignoreCase = isolate->heap()->false_value(); | 1867 if (!ignoreCase->IsTrue()) ignoreCase = isolate->heap()->false_value(); |
| 1866 | 1868 |
| (...skipping 6943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8810 // Setting read only property in strict mode. | 8812 // Setting read only property in strict mode. |
| 8811 Handle<Object> error = | 8813 Handle<Object> error = |
| 8812 isolate->factory()->NewTypeError( | 8814 isolate->factory()->NewTypeError( |
| 8813 "strict_cannot_assign", HandleVector(&name, 1)); | 8815 "strict_cannot_assign", HandleVector(&name, 1)); |
| 8814 return isolate->Throw(*error); | 8816 return isolate->Throw(*error); |
| 8815 } | 8817 } |
| 8816 return *value; | 8818 return *value; |
| 8817 } | 8819 } |
| 8818 | 8820 |
| 8819 | 8821 |
| 8822 // Returns the offset in "code" where the code has been patched, as a SMI. |
| 8823 RUNTIME_FUNCTION(MaybeObject*, Runtime_CatchInOptimizedCode) { |
| 8824 HandleScope scope(isolate); |
| 8825 ASSERT(args.length() == 1); |
| 8826 Code* code = reinterpret_cast<Code*>(args[0]); |
| 8827 |
| 8828 // From the safepoint of the call (i.e., the frame's pc) we can get the |
| 8829 // offset of the lazy deoptimization point. |
| 8830 DeoptimizationInputData* deopt_data = |
| 8831 DeoptimizationInputData::cast(code->deoptimization_data()); |
| 8832 int deopt_index = isolate->optimized_handler_deopt_index(); |
| 8833 ASSERT(deopt_index < deopt_data->DeoptCount()); |
| 8834 |
| 8835 // Save the code at the lazy deoptimization point off to the side and |
| 8836 // patch the lazy deoptimization point with a call to the lazy deopt stub. |
| 8837 int patch_size = Deoptimizer::patch_size(); |
| 8838 Address patch_address = |
| 8839 code->instruction_start() + deopt_data->Pc(deopt_index)->value(); |
| 8840 isolate->set_optimized_handler_patch_buffer(patch_address, patch_size); |
| 8841 CodePatcher patcher(patch_address, patch_size); |
| 8842 Address deopt_entry = |
| 8843 Deoptimizer::GetDeoptimizationEntry(deopt_index, Deoptimizer::LAZY); |
| 8844 patcher.masm()->call(deopt_entry, RelocInfo::NONE); |
| 8845 |
| 8846 // Lazy deoptimization expects to find the code in a linked list. |
| 8847 isolate->deoptimizer_data()->append_deoptimizing_code(code); |
| 8848 |
| 8849 int frame_pc_offset = isolate->optimized_handler_frame_pc_offset(); |
| 8850 isolate->clear_optimized_handler_frame_pc_offset(); |
| 8851 return Smi::FromInt(frame_pc_offset); |
| 8852 } |
| 8853 |
| 8854 |
| 8820 RUNTIME_FUNCTION(MaybeObject*, Runtime_Throw) { | 8855 RUNTIME_FUNCTION(MaybeObject*, Runtime_Throw) { |
| 8821 HandleScope scope(isolate); | 8856 HandleScope scope(isolate); |
| 8822 ASSERT(args.length() == 1); | 8857 ASSERT(args.length() == 1); |
| 8823 | 8858 |
| 8824 return isolate->Throw(args[0]); | 8859 return isolate->Throw(args[0]); |
| 8825 } | 8860 } |
| 8826 | 8861 |
| 8827 | 8862 |
| 8828 RUNTIME_FUNCTION(MaybeObject*, Runtime_ReThrow) { | 8863 RUNTIME_FUNCTION(MaybeObject*, Runtime_ReThrow) { |
| 8829 HandleScope scope(isolate); | 8864 HandleScope scope(isolate); |
| (...skipping 4455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13285 // Handle last resort GC and make sure to allow future allocations | 13320 // Handle last resort GC and make sure to allow future allocations |
| 13286 // to grow the heap without causing GCs (if possible). | 13321 // to grow the heap without causing GCs (if possible). |
| 13287 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13322 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13288 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13323 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13289 "Runtime::PerformGC"); | 13324 "Runtime::PerformGC"); |
| 13290 } | 13325 } |
| 13291 } | 13326 } |
| 13292 | 13327 |
| 13293 | 13328 |
| 13294 } } // namespace v8::internal | 13329 } } // namespace v8::internal |
| OLD | NEW |