| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 | 825 |
| 826 | 826 |
| 827 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 827 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, |
| 828 int frame_index) { | 828 int frame_index) { |
| 829 TranslatedFrame* translated_frame = | 829 TranslatedFrame* translated_frame = |
| 830 &(translated_state_.frames()[frame_index]); | 830 &(translated_state_.frames()[frame_index]); |
| 831 TranslatedFrame::iterator value_iterator = translated_frame->begin(); | 831 TranslatedFrame::iterator value_iterator = translated_frame->begin(); |
| 832 int input_index = 0; | 832 int input_index = 0; |
| 833 | 833 |
| 834 BailoutId node_id = translated_frame->node_id(); | 834 BailoutId node_id = translated_frame->node_id(); |
| 835 JSFunction* function = translated_frame->raw_function(); | |
| 836 unsigned height = | 835 unsigned height = |
| 837 translated_frame->height() - 1; // Do not count the context. | 836 translated_frame->height() - 1; // Do not count the context. |
| 838 unsigned height_in_bytes = height * kPointerSize; | 837 unsigned height_in_bytes = height * kPointerSize; |
| 838 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); |
| 839 value_iterator++; |
| 839 if (trace_scope_ != NULL) { | 840 if (trace_scope_ != NULL) { |
| 840 PrintF(trace_scope_->file(), " translating frame "); | 841 PrintF(trace_scope_->file(), " translating frame "); |
| 841 function->PrintName(trace_scope_->file()); | 842 function->PrintName(trace_scope_->file()); |
| 842 PrintF(trace_scope_->file(), | 843 PrintF(trace_scope_->file(), |
| 843 " => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes); | 844 " => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes); |
| 844 } | 845 } |
| 845 | 846 |
| 846 // The 'fixed' part of the frame consists of the incoming parameters and | 847 // The 'fixed' part of the frame consists of the incoming parameters and |
| 847 // the part described by JavaScriptFrameConstants. | 848 // the part described by JavaScriptFrameConstants. |
| 848 unsigned fixed_frame_size = ComputeFixedSize(function); | 849 unsigned fixed_frame_size = ComputeFixedSize(function); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 } | 1065 } |
| 1065 | 1066 |
| 1066 | 1067 |
| 1067 void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, | 1068 void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, |
| 1068 int frame_index) { | 1069 int frame_index) { |
| 1069 TranslatedFrame* translated_frame = | 1070 TranslatedFrame* translated_frame = |
| 1070 &(translated_state_.frames()[frame_index]); | 1071 &(translated_state_.frames()[frame_index]); |
| 1071 TranslatedFrame::iterator value_iterator = translated_frame->begin(); | 1072 TranslatedFrame::iterator value_iterator = translated_frame->begin(); |
| 1072 int input_index = 0; | 1073 int input_index = 0; |
| 1073 | 1074 |
| 1074 JSFunction* function = translated_frame->raw_function(); | |
| 1075 unsigned height = translated_frame->height(); | 1075 unsigned height = translated_frame->height(); |
| 1076 unsigned height_in_bytes = height * kPointerSize; | 1076 unsigned height_in_bytes = height * kPointerSize; |
| 1077 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); |
| 1078 value_iterator++; |
| 1077 if (trace_scope_ != NULL) { | 1079 if (trace_scope_ != NULL) { |
| 1078 PrintF(trace_scope_->file(), | 1080 PrintF(trace_scope_->file(), |
| 1079 " translating arguments adaptor => height=%d\n", height_in_bytes); | 1081 " translating arguments adaptor => height=%d\n", height_in_bytes); |
| 1080 } | 1082 } |
| 1081 | 1083 |
| 1082 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize; | 1084 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize; |
| 1083 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1085 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1084 | 1086 |
| 1085 // Allocate and store the output frame description. | 1087 // Allocate and store the output frame description. |
| 1086 FrameDescription* output_frame = | 1088 FrameDescription* output_frame = |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 | 1198 |
| 1197 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, | 1199 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, |
| 1198 int frame_index) { | 1200 int frame_index) { |
| 1199 TranslatedFrame* translated_frame = | 1201 TranslatedFrame* translated_frame = |
| 1200 &(translated_state_.frames()[frame_index]); | 1202 &(translated_state_.frames()[frame_index]); |
| 1201 TranslatedFrame::iterator value_iterator = translated_frame->begin(); | 1203 TranslatedFrame::iterator value_iterator = translated_frame->begin(); |
| 1202 int input_index = 0; | 1204 int input_index = 0; |
| 1203 | 1205 |
| 1204 Builtins* builtins = isolate_->builtins(); | 1206 Builtins* builtins = isolate_->builtins(); |
| 1205 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); | 1207 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); |
| 1206 JSFunction* function = translated_frame->raw_function(); | |
| 1207 unsigned height = translated_frame->height(); | 1208 unsigned height = translated_frame->height(); |
| 1208 unsigned height_in_bytes = height * kPointerSize; | 1209 unsigned height_in_bytes = height * kPointerSize; |
| 1210 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); |
| 1211 value_iterator++; |
| 1209 if (trace_scope_ != NULL) { | 1212 if (trace_scope_ != NULL) { |
| 1210 PrintF(trace_scope_->file(), | 1213 PrintF(trace_scope_->file(), |
| 1211 " translating construct stub => height=%d\n", height_in_bytes); | 1214 " translating construct stub => height=%d\n", height_in_bytes); |
| 1212 } | 1215 } |
| 1213 | 1216 |
| 1214 unsigned fixed_frame_size = ConstructFrameConstants::kFrameSize; | 1217 unsigned fixed_frame_size = ConstructFrameConstants::kFrameSize; |
| 1215 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1218 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1216 | 1219 |
| 1217 // Allocate and store the output frame description. | 1220 // Allocate and store the output frame description. |
| 1218 FrameDescription* output_frame = | 1221 FrameDescription* output_frame = |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 | 1367 |
| 1365 | 1368 |
| 1366 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, | 1369 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, |
| 1367 int frame_index, | 1370 int frame_index, |
| 1368 bool is_setter_stub_frame) { | 1371 bool is_setter_stub_frame) { |
| 1369 TranslatedFrame* translated_frame = | 1372 TranslatedFrame* translated_frame = |
| 1370 &(translated_state_.frames()[frame_index]); | 1373 &(translated_state_.frames()[frame_index]); |
| 1371 TranslatedFrame::iterator value_iterator = translated_frame->begin(); | 1374 TranslatedFrame::iterator value_iterator = translated_frame->begin(); |
| 1372 int input_index = 0; | 1375 int input_index = 0; |
| 1373 | 1376 |
| 1374 JSFunction* accessor = translated_frame->raw_function(); | 1377 JSFunction* accessor = JSFunction::cast(value_iterator->GetRawValue()); |
| 1378 value_iterator++; |
| 1375 // The receiver (and the implicit return value, if any) are expected in | 1379 // The receiver (and the implicit return value, if any) are expected in |
| 1376 // registers by the LoadIC/StoreIC, so they don't belong to the output stack | 1380 // registers by the LoadIC/StoreIC, so they don't belong to the output stack |
| 1377 // frame. This means that we have to use a height of 0. | 1381 // frame. This means that we have to use a height of 0. |
| 1378 unsigned height = 0; | 1382 unsigned height = 0; |
| 1379 unsigned height_in_bytes = height * kPointerSize; | 1383 unsigned height_in_bytes = height * kPointerSize; |
| 1380 const char* kind = is_setter_stub_frame ? "setter" : "getter"; | 1384 const char* kind = is_setter_stub_frame ? "setter" : "getter"; |
| 1381 if (trace_scope_ != NULL) { | 1385 if (trace_scope_ != NULL) { |
| 1382 PrintF(trace_scope_->file(), | 1386 PrintF(trace_scope_->file(), |
| 1383 " translating %s stub => height=%u\n", kind, height_in_bytes); | 1387 " translating %s stub => height=%u\n", kind, height_in_bytes); |
| 1384 } | 1388 } |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 | 1809 |
| 1806 void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame( | 1810 void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame( |
| 1807 int frame_index, int parameter_count, int expression_count, | 1811 int frame_index, int parameter_count, int expression_count, |
| 1808 DeoptimizedFrameInfo* info) { | 1812 DeoptimizedFrameInfo* info) { |
| 1809 CHECK_EQ(DEBUGGER, bailout_type_); | 1813 CHECK_EQ(DEBUGGER, bailout_type_); |
| 1810 | 1814 |
| 1811 translated_state_.Prepare(false, nullptr); | 1815 translated_state_.Prepare(false, nullptr); |
| 1812 | 1816 |
| 1813 TranslatedFrame* frame = &(translated_state_.frames()[frame_index]); | 1817 TranslatedFrame* frame = &(translated_state_.frames()[frame_index]); |
| 1814 CHECK(frame->kind() == TranslatedFrame::kFunction); | 1818 CHECK(frame->kind() == TranslatedFrame::kFunction); |
| 1815 int frame_arg_count = | 1819 int frame_arg_count = frame->shared_info()->internal_formal_parameter_count(); |
| 1816 frame->function()->shared()->internal_formal_parameter_count(); | |
| 1817 | 1820 |
| 1818 // The height is #expressions + 1 for context. | 1821 // The height is #expressions + 1 for context. |
| 1819 CHECK_EQ(expression_count + 1, frame->height()); | 1822 CHECK_EQ(expression_count + 1, frame->height()); |
| 1820 TranslatedFrame* argument_frame = frame; | 1823 TranslatedFrame* argument_frame = frame; |
| 1821 if (frame_index > 0) { | 1824 if (frame_index > 0) { |
| 1822 TranslatedFrame* previous_frame = | 1825 TranslatedFrame* previous_frame = |
| 1823 &(translated_state_.frames()[frame_index - 1]); | 1826 &(translated_state_.frames()[frame_index - 1]); |
| 1824 if (previous_frame->kind() == TranslatedFrame::kArgumentsAdaptor) { | 1827 if (previous_frame->kind() == TranslatedFrame::kArgumentsAdaptor) { |
| 1825 argument_frame = previous_frame; | 1828 argument_frame = previous_frame; |
| 1826 CHECK_EQ(parameter_count, argument_frame->height() - 1); | 1829 CHECK_EQ(parameter_count, argument_frame->height() - 1); |
| 1827 } else { | 1830 } else { |
| 1828 CHECK_EQ(frame_arg_count, parameter_count); | 1831 CHECK_EQ(frame_arg_count, parameter_count); |
| 1829 } | 1832 } |
| 1830 } else { | 1833 } else { |
| 1831 CHECK_EQ(frame_arg_count, parameter_count); | 1834 CHECK_EQ(frame_arg_count, parameter_count); |
| 1832 } | 1835 } |
| 1833 | 1836 |
| 1834 TranslatedFrame::iterator arg_iter = argument_frame->begin(); | 1837 TranslatedFrame::iterator arg_iter = argument_frame->begin(); |
| 1838 arg_iter++; // Skip the function. |
| 1835 arg_iter++; // Skip the receiver. | 1839 arg_iter++; // Skip the receiver. |
| 1836 for (int i = 0; i < parameter_count; i++, arg_iter++) { | 1840 for (int i = 0; i < parameter_count; i++, arg_iter++) { |
| 1837 if (!arg_iter->IsMaterializedObject()) { | 1841 if (!arg_iter->IsMaterializedObject()) { |
| 1838 info->SetParameter(i, *(arg_iter->GetValue())); | 1842 info->SetParameter(i, *(arg_iter->GetValue())); |
| 1839 } | 1843 } |
| 1840 } | 1844 } |
| 1841 | 1845 |
| 1842 TranslatedFrame::iterator iter = frame->begin(); | 1846 TranslatedFrame::iterator iter = frame->begin(); |
| 1843 // Skip the arguments, receiver and context. | 1847 // Skip the function, receiver, context and arguments. |
| 1844 for (int i = 0; i < frame_arg_count + 2; i++, iter++) { | 1848 for (int i = 0; i < frame_arg_count + 3; i++, iter++) { |
| 1845 } | 1849 } |
| 1846 | 1850 |
| 1847 for (int i = 0; i < expression_count; i++, iter++) { | 1851 for (int i = 0; i < expression_count; i++, iter++) { |
| 1848 if (!iter->IsMaterializedObject()) { | 1852 if (!iter->IsMaterializedObject()) { |
| 1849 info->SetExpression(i, *(iter->GetValue())); | 1853 info->SetExpression(i, *(iter->GetValue())); |
| 1850 } | 1854 } |
| 1851 } | 1855 } |
| 1852 } | 1856 } |
| 1853 | 1857 |
| 1854 | 1858 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2229 void Translation::StoreArgumentsObject(bool args_known, | 2233 void Translation::StoreArgumentsObject(bool args_known, |
| 2230 int args_index, | 2234 int args_index, |
| 2231 int args_length) { | 2235 int args_length) { |
| 2232 buffer_->Add(ARGUMENTS_OBJECT, zone()); | 2236 buffer_->Add(ARGUMENTS_OBJECT, zone()); |
| 2233 buffer_->Add(args_known, zone()); | 2237 buffer_->Add(args_known, zone()); |
| 2234 buffer_->Add(args_index, zone()); | 2238 buffer_->Add(args_index, zone()); |
| 2235 buffer_->Add(args_length, zone()); | 2239 buffer_->Add(args_length, zone()); |
| 2236 } | 2240 } |
| 2237 | 2241 |
| 2238 | 2242 |
| 2243 void Translation::StoreJSFrameFunction() { |
| 2244 buffer_->Add(JS_FRAME_FUNCTION, zone()); |
| 2245 } |
| 2246 |
| 2247 |
| 2239 int Translation::NumberOfOperandsFor(Opcode opcode) { | 2248 int Translation::NumberOfOperandsFor(Opcode opcode) { |
| 2240 switch (opcode) { | 2249 switch (opcode) { |
| 2250 case JS_FRAME_FUNCTION: |
| 2251 return 0; |
| 2241 case GETTER_STUB_FRAME: | 2252 case GETTER_STUB_FRAME: |
| 2242 case SETTER_STUB_FRAME: | 2253 case SETTER_STUB_FRAME: |
| 2243 case DUPLICATED_OBJECT: | 2254 case DUPLICATED_OBJECT: |
| 2244 case ARGUMENTS_OBJECT: | 2255 case ARGUMENTS_OBJECT: |
| 2245 case CAPTURED_OBJECT: | 2256 case CAPTURED_OBJECT: |
| 2246 case REGISTER: | 2257 case REGISTER: |
| 2247 case INT32_REGISTER: | 2258 case INT32_REGISTER: |
| 2248 case UINT32_REGISTER: | 2259 case UINT32_REGISTER: |
| 2249 case BOOL_REGISTER: | 2260 case BOOL_REGISTER: |
| 2250 case DOUBLE_REGISTER: | 2261 case DOUBLE_REGISTER: |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2734 | 2745 |
| 2735 void TranslatedValue::Handlify() { | 2746 void TranslatedValue::Handlify() { |
| 2736 if (kind() == kTagged) { | 2747 if (kind() == kTagged) { |
| 2737 value_ = Handle<Object>(raw_literal(), isolate()); | 2748 value_ = Handle<Object>(raw_literal(), isolate()); |
| 2738 raw_literal_ = nullptr; | 2749 raw_literal_ = nullptr; |
| 2739 } | 2750 } |
| 2740 } | 2751 } |
| 2741 | 2752 |
| 2742 | 2753 |
| 2743 TranslatedFrame TranslatedFrame::JSFrame(BailoutId node_id, | 2754 TranslatedFrame TranslatedFrame::JSFrame(BailoutId node_id, |
| 2744 JSFunction* function, int height) { | 2755 SharedFunctionInfo* shared_info, |
| 2745 TranslatedFrame frame(kFunction, function->GetIsolate(), function, height); | 2756 int height) { |
| 2757 TranslatedFrame frame(kFunction, shared_info->GetIsolate(), shared_info, |
| 2758 height); |
| 2746 frame.node_id_ = node_id; | 2759 frame.node_id_ = node_id; |
| 2747 return frame; | 2760 return frame; |
| 2748 } | 2761 } |
| 2749 | 2762 |
| 2750 | 2763 |
| 2751 TranslatedFrame TranslatedFrame::AccessorFrame(Kind kind, | 2764 TranslatedFrame TranslatedFrame::AccessorFrame( |
| 2752 JSFunction* function) { | 2765 Kind kind, SharedFunctionInfo* shared_info) { |
| 2753 DCHECK(kind == kSetter || kind == kGetter); | 2766 DCHECK(kind == kSetter || kind == kGetter); |
| 2754 return TranslatedFrame(kind, function->GetIsolate(), function); | 2767 return TranslatedFrame(kind, shared_info->GetIsolate(), shared_info); |
| 2755 } | 2768 } |
| 2756 | 2769 |
| 2757 | 2770 |
| 2758 TranslatedFrame TranslatedFrame::ArgumentsAdaptorFrame(JSFunction* function, | 2771 TranslatedFrame TranslatedFrame::ArgumentsAdaptorFrame( |
| 2759 int height) { | 2772 SharedFunctionInfo* shared_info, int height) { |
| 2760 return TranslatedFrame(kArgumentsAdaptor, function->GetIsolate(), function, | 2773 return TranslatedFrame(kArgumentsAdaptor, shared_info->GetIsolate(), |
| 2774 shared_info, height); |
| 2775 } |
| 2776 |
| 2777 |
| 2778 TranslatedFrame TranslatedFrame::ConstructStubFrame( |
| 2779 SharedFunctionInfo* shared_info, int height) { |
| 2780 return TranslatedFrame(kConstructStub, shared_info->GetIsolate(), shared_info, |
| 2761 height); | 2781 height); |
| 2762 } | 2782 } |
| 2763 | 2783 |
| 2764 | |
| 2765 TranslatedFrame TranslatedFrame::ConstructStubFrame(JSFunction* function, | |
| 2766 int height) { | |
| 2767 return TranslatedFrame(kConstructStub, function->GetIsolate(), function, | |
| 2768 height); | |
| 2769 } | |
| 2770 | |
| 2771 | 2784 |
| 2772 int TranslatedFrame::GetValueCount() { | 2785 int TranslatedFrame::GetValueCount() { |
| 2773 switch (kind()) { | 2786 switch (kind()) { |
| 2774 case kFunction: { | 2787 case kFunction: { |
| 2775 int parameter_count = | 2788 int parameter_count = |
| 2776 (raw_function_ == nullptr | 2789 raw_shared_info_->internal_formal_parameter_count() + 1; |
| 2777 ? function_->shared()->internal_formal_parameter_count() | 2790 return height_ + parameter_count + 1; |
| 2778 : raw_function_->shared()->internal_formal_parameter_count()) + | |
| 2779 1; | |
| 2780 return height_ + parameter_count; | |
| 2781 } | 2791 } |
| 2782 | 2792 |
| 2783 case kGetter: | 2793 case kGetter: |
| 2784 return 1; // Receiver. | 2794 return 2; // Function and receiver. |
| 2785 | 2795 |
| 2786 case kSetter: | 2796 case kSetter: |
| 2787 return 2; // Receiver and the value to set. | 2797 return 3; // Function, receiver and the value to set. |
| 2788 | 2798 |
| 2789 case kArgumentsAdaptor: | 2799 case kArgumentsAdaptor: |
| 2790 case kConstructStub: | 2800 case kConstructStub: |
| 2801 return 1 + height_; |
| 2802 |
| 2791 case kCompiledStub: | 2803 case kCompiledStub: |
| 2792 return height_; | 2804 return height_; |
| 2793 | 2805 |
| 2794 case kInvalid: | 2806 case kInvalid: |
| 2795 UNREACHABLE(); | 2807 UNREACHABLE(); |
| 2796 break; | 2808 break; |
| 2797 } | 2809 } |
| 2798 UNREACHABLE(); | 2810 UNREACHABLE(); |
| 2799 return -1; | 2811 return -1; |
| 2800 } | 2812 } |
| 2801 | 2813 |
| 2802 | 2814 |
| 2803 void TranslatedFrame::Handlify(Isolate* isolate) { | 2815 void TranslatedFrame::Handlify() { |
| 2804 if (raw_function_ != nullptr) { | 2816 if (raw_shared_info_ != nullptr) { |
| 2805 function_ = Handle<JSFunction>(raw_function_, isolate); | 2817 shared_info_ = Handle<SharedFunctionInfo>(raw_shared_info_); |
| 2806 raw_function_ = nullptr; | 2818 raw_shared_info_ = nullptr; |
| 2807 } | 2819 } |
| 2808 for (auto& value : values_) { | 2820 for (auto& value : values_) { |
| 2809 value.Handlify(); | 2821 value.Handlify(); |
| 2810 } | 2822 } |
| 2811 } | 2823 } |
| 2812 | 2824 |
| 2813 | 2825 |
| 2814 TranslatedFrame TranslatedState::CreateNextTranslatedFrame( | 2826 TranslatedFrame TranslatedState::CreateNextTranslatedFrame( |
| 2815 TranslationIterator* iterator, FixedArray* literal_array, Address fp, | 2827 TranslationIterator* iterator, FixedArray* literal_array, Address fp, |
| 2816 JSFunction* frame_function, FILE* trace_file) { | 2828 JSFunction* frame_function, FILE* trace_file) { |
| 2817 Translation::Opcode opcode = | 2829 Translation::Opcode opcode = |
| 2818 static_cast<Translation::Opcode>(iterator->Next()); | 2830 static_cast<Translation::Opcode>(iterator->Next()); |
| 2819 switch (opcode) { | 2831 switch (opcode) { |
| 2820 case Translation::JS_FRAME: { | 2832 case Translation::JS_FRAME: { |
| 2821 BailoutId node_id = BailoutId(iterator->Next()); | 2833 BailoutId node_id = BailoutId(iterator->Next()); |
| 2822 int closure_id = iterator->Next(); | 2834 SharedFunctionInfo* shared_info = |
| 2823 JSFunction* function = | 2835 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); |
| 2824 (closure_id == Translation::kSelfLiteralId) | |
| 2825 ? frame_function | |
| 2826 : JSFunction::cast(literal_array->get(closure_id)); | |
| 2827 int height = iterator->Next(); | 2836 int height = iterator->Next(); |
| 2828 if (trace_file != nullptr) { | 2837 if (trace_file != nullptr) { |
| 2829 PrintF(trace_file, " reading input frame "); | 2838 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString(); |
| 2830 function->PrintName(trace_file); | 2839 PrintF(trace_file, " reading input frame %s", name.get()); |
| 2831 int arg_count = | 2840 int arg_count = shared_info->internal_formal_parameter_count() + 1; |
| 2832 function->shared()->internal_formal_parameter_count() + 1; | |
| 2833 PrintF(trace_file, " => node=%d, args=%d, height=%d; inputs:\n", | 2841 PrintF(trace_file, " => node=%d, args=%d, height=%d; inputs:\n", |
| 2834 arg_count, node_id.ToInt(), height); | 2842 arg_count, node_id.ToInt(), height); |
| 2835 } | 2843 } |
| 2836 return TranslatedFrame::JSFrame(node_id, function, height); | 2844 return TranslatedFrame::JSFrame(node_id, shared_info, height); |
| 2837 } | 2845 } |
| 2838 | 2846 |
| 2839 case Translation::ARGUMENTS_ADAPTOR_FRAME: { | 2847 case Translation::ARGUMENTS_ADAPTOR_FRAME: { |
| 2840 JSFunction* function = | 2848 SharedFunctionInfo* shared_info = |
| 2841 JSFunction::cast(literal_array->get(iterator->Next())); | 2849 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); |
| 2842 int height = iterator->Next(); | 2850 int height = iterator->Next(); |
| 2843 if (trace_file != nullptr) { | 2851 if (trace_file != nullptr) { |
| 2844 PrintF(trace_file, " reading arguments adaptor frame"); | 2852 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString(); |
| 2845 function->PrintName(trace_file); | 2853 PrintF(trace_file, " reading arguments adaptor frame %s", name.get()); |
| 2846 PrintF(trace_file, " => height=%d; inputs:\n", height); | 2854 PrintF(trace_file, " => height=%d; inputs:\n", height); |
| 2847 } | 2855 } |
| 2848 return TranslatedFrame::ArgumentsAdaptorFrame(function, height); | 2856 return TranslatedFrame::ArgumentsAdaptorFrame(shared_info, height); |
| 2849 } | 2857 } |
| 2850 | 2858 |
| 2851 case Translation::CONSTRUCT_STUB_FRAME: { | 2859 case Translation::CONSTRUCT_STUB_FRAME: { |
| 2852 JSFunction* function = | 2860 SharedFunctionInfo* shared_info = |
| 2853 JSFunction::cast(literal_array->get(iterator->Next())); | 2861 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); |
| 2854 int height = iterator->Next(); | 2862 int height = iterator->Next(); |
| 2855 if (trace_file != nullptr) { | 2863 if (trace_file != nullptr) { |
| 2856 PrintF(trace_file, " reading construct stub frame "); | 2864 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString(); |
| 2857 function->PrintName(trace_file); | 2865 PrintF(trace_file, " reading construct stub frame %s", name.get()); |
| 2858 PrintF(trace_file, " => height=%d; inputs:\n", height); | 2866 PrintF(trace_file, " => height=%d; inputs:\n", height); |
| 2859 } | 2867 } |
| 2860 return TranslatedFrame::ConstructStubFrame(function, height); | 2868 return TranslatedFrame::ConstructStubFrame(shared_info, height); |
| 2861 } | 2869 } |
| 2862 | 2870 |
| 2863 case Translation::GETTER_STUB_FRAME: { | 2871 case Translation::GETTER_STUB_FRAME: { |
| 2864 JSFunction* function = | 2872 SharedFunctionInfo* shared_info = |
| 2865 JSFunction::cast(literal_array->get(iterator->Next())); | 2873 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); |
| 2866 if (trace_file != nullptr) { | 2874 if (trace_file != nullptr) { |
| 2867 PrintF(trace_file, " reading getter frame "); | 2875 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString(); |
| 2868 function->PrintName(trace_file); | 2876 PrintF(trace_file, " reading getter frame %s; inputs:\n", name.get()); |
| 2869 PrintF(trace_file, "; inputs:\n"); | |
| 2870 } | 2877 } |
| 2871 return TranslatedFrame::AccessorFrame(TranslatedFrame::kGetter, function); | 2878 return TranslatedFrame::AccessorFrame(TranslatedFrame::kGetter, |
| 2879 shared_info); |
| 2872 } | 2880 } |
| 2873 | 2881 |
| 2874 case Translation::SETTER_STUB_FRAME: { | 2882 case Translation::SETTER_STUB_FRAME: { |
| 2875 JSFunction* function = | 2883 SharedFunctionInfo* shared_info = |
| 2876 JSFunction::cast(literal_array->get(iterator->Next())); | 2884 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); |
| 2877 if (trace_file != nullptr) { | 2885 if (trace_file != nullptr) { |
| 2878 PrintF(trace_file, " reading setter frame "); | 2886 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString(); |
| 2879 function->PrintName(trace_file); | 2887 PrintF(trace_file, " reading setter frame %s; inputs:\n", name.get()); |
| 2880 PrintF(trace_file, "; inputs:\n"); | |
| 2881 } | 2888 } |
| 2882 return TranslatedFrame::AccessorFrame(TranslatedFrame::kSetter, function); | 2889 return TranslatedFrame::AccessorFrame(TranslatedFrame::kSetter, |
| 2890 shared_info); |
| 2883 } | 2891 } |
| 2884 | 2892 |
| 2885 case Translation::COMPILED_STUB_FRAME: { | 2893 case Translation::COMPILED_STUB_FRAME: { |
| 2886 int height = iterator->Next(); | 2894 int height = iterator->Next(); |
| 2887 if (trace_file != nullptr) { | 2895 if (trace_file != nullptr) { |
| 2888 PrintF(trace_file, | 2896 PrintF(trace_file, |
| 2889 " reading compiler stub frame => height=%d; inputs:\n", height); | 2897 " reading compiler stub frame => height=%d; inputs:\n", height); |
| 2890 } | 2898 } |
| 2891 return TranslatedFrame::CompiledStubFrame(height, | 2899 return TranslatedFrame::CompiledStubFrame(height, |
| 2892 literal_array->GetIsolate()); | 2900 literal_array->GetIsolate()); |
| 2893 } | 2901 } |
| 2894 | 2902 |
| 2895 case Translation::BEGIN: | 2903 case Translation::BEGIN: |
| 2896 case Translation::DUPLICATED_OBJECT: | 2904 case Translation::DUPLICATED_OBJECT: |
| 2897 case Translation::ARGUMENTS_OBJECT: | 2905 case Translation::ARGUMENTS_OBJECT: |
| 2898 case Translation::CAPTURED_OBJECT: | 2906 case Translation::CAPTURED_OBJECT: |
| 2899 case Translation::REGISTER: | 2907 case Translation::REGISTER: |
| 2900 case Translation::INT32_REGISTER: | 2908 case Translation::INT32_REGISTER: |
| 2901 case Translation::UINT32_REGISTER: | 2909 case Translation::UINT32_REGISTER: |
| 2902 case Translation::BOOL_REGISTER: | 2910 case Translation::BOOL_REGISTER: |
| 2903 case Translation::DOUBLE_REGISTER: | 2911 case Translation::DOUBLE_REGISTER: |
| 2904 case Translation::STACK_SLOT: | 2912 case Translation::STACK_SLOT: |
| 2905 case Translation::INT32_STACK_SLOT: | 2913 case Translation::INT32_STACK_SLOT: |
| 2906 case Translation::UINT32_STACK_SLOT: | 2914 case Translation::UINT32_STACK_SLOT: |
| 2907 case Translation::BOOL_STACK_SLOT: | 2915 case Translation::BOOL_STACK_SLOT: |
| 2908 case Translation::DOUBLE_STACK_SLOT: | 2916 case Translation::DOUBLE_STACK_SLOT: |
| 2909 case Translation::LITERAL: | 2917 case Translation::LITERAL: |
| 2918 case Translation::JS_FRAME_FUNCTION: |
| 2910 break; | 2919 break; |
| 2911 } | 2920 } |
| 2912 FATAL("We should never get here - unexpected deopt info."); | 2921 FATAL("We should never get here - unexpected deopt info."); |
| 2913 return TranslatedFrame::InvalidFrame(); | 2922 return TranslatedFrame::InvalidFrame(); |
| 2914 } | 2923 } |
| 2915 | 2924 |
| 2916 | 2925 |
| 2917 // static | 2926 // static |
| 2918 void TranslatedFrame::AdvanceIterator( | 2927 void TranslatedFrame::AdvanceIterator( |
| 2919 std::deque<TranslatedValue>::iterator* iter) { | 2928 std::deque<TranslatedValue>::iterator* iter) { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 int literal_index = iterator->Next(); | 3105 int literal_index = iterator->Next(); |
| 3097 Object* value = literal_array->get(literal_index); | 3106 Object* value = literal_array->get(literal_index); |
| 3098 if (trace_file != nullptr) { | 3107 if (trace_file != nullptr) { |
| 3099 PrintF(trace_file, "0x%08" V8PRIxPTR " ; (literal %d) ", | 3108 PrintF(trace_file, "0x%08" V8PRIxPTR " ; (literal %d) ", |
| 3100 reinterpret_cast<intptr_t>(value), literal_index); | 3109 reinterpret_cast<intptr_t>(value), literal_index); |
| 3101 reinterpret_cast<Object*>(value)->ShortPrint(trace_file); | 3110 reinterpret_cast<Object*>(value)->ShortPrint(trace_file); |
| 3102 } | 3111 } |
| 3103 | 3112 |
| 3104 return TranslatedValue::NewTagged(this, value); | 3113 return TranslatedValue::NewTagged(this, value); |
| 3105 } | 3114 } |
| 3115 |
| 3116 case Translation::JS_FRAME_FUNCTION: { |
| 3117 int slot_offset = JavaScriptFrameConstants::kFunctionOffset; |
| 3118 intptr_t value = *(reinterpret_cast<intptr_t*>(fp + slot_offset)); |
| 3119 if (trace_file != nullptr) { |
| 3120 PrintF(trace_file, "0x%08" V8PRIxPTR " ; (frame function) ", value); |
| 3121 reinterpret_cast<Object*>(value)->ShortPrint(trace_file); |
| 3122 } |
| 3123 return TranslatedValue::NewTagged(this, reinterpret_cast<Object*>(value)); |
| 3124 } |
| 3106 } | 3125 } |
| 3107 | 3126 |
| 3108 FATAL("We should never get here - unexpected deopt info."); | 3127 FATAL("We should never get here - unexpected deopt info."); |
| 3109 return TranslatedValue(nullptr, TranslatedValue::kInvalid); | 3128 return TranslatedValue(nullptr, TranslatedValue::kInvalid); |
| 3110 } | 3129 } |
| 3111 | 3130 |
| 3112 | 3131 |
| 3113 TranslatedState::TranslatedState(JavaScriptFrame* frame) | 3132 TranslatedState::TranslatedState(JavaScriptFrame* frame) |
| 3114 : isolate_(nullptr), | 3133 : isolate_(nullptr), |
| 3115 stack_frame_pointer_(nullptr), | 3134 stack_frame_pointer_(nullptr), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3157 CreateNextTranslatedFrame(iterator, literal_array, input_frame_pointer, | 3176 CreateNextTranslatedFrame(iterator, literal_array, input_frame_pointer, |
| 3158 input_frame_function, trace_file)); | 3177 input_frame_function, trace_file)); |
| 3159 TranslatedFrame& frame = frames_.back(); | 3178 TranslatedFrame& frame = frames_.back(); |
| 3160 | 3179 |
| 3161 // Read the values. | 3180 // Read the values. |
| 3162 int values_to_process = frame.GetValueCount(); | 3181 int values_to_process = frame.GetValueCount(); |
| 3163 while (values_to_process > 0 || !nested_counts.empty()) { | 3182 while (values_to_process > 0 || !nested_counts.empty()) { |
| 3164 if (trace_file != nullptr) { | 3183 if (trace_file != nullptr) { |
| 3165 if (nested_counts.empty()) { | 3184 if (nested_counts.empty()) { |
| 3166 // For top level values, print the value number. | 3185 // For top level values, print the value number. |
| 3167 PrintF(trace_file, " %3i: ", | 3186 PrintF(trace_file, " %3zu: ", frame.size()); |
| 3168 frame.GetValueCount() - values_to_process); | |
| 3169 } else { | 3187 } else { |
| 3170 // Take care of indenting for nested values. | 3188 // Take care of indenting for nested values. |
| 3171 PrintF(trace_file, " "); | 3189 PrintF(trace_file, " "); |
| 3172 for (size_t j = 0; j < nested_counts.size(); j++) { | 3190 for (size_t j = 0; j < nested_counts.size(); j++) { |
| 3173 PrintF(trace_file, " "); | 3191 PrintF(trace_file, " "); |
| 3174 } | 3192 } |
| 3175 } | 3193 } |
| 3176 } | 3194 } |
| 3177 | 3195 |
| 3178 TranslatedValue value = CreateNextTranslatedValue( | 3196 TranslatedValue value = CreateNextTranslatedValue( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3200 } | 3218 } |
| 3201 | 3219 |
| 3202 CHECK(!iterator->HasNext() || | 3220 CHECK(!iterator->HasNext() || |
| 3203 static_cast<Translation::Opcode>(iterator->Next()) == | 3221 static_cast<Translation::Opcode>(iterator->Next()) == |
| 3204 Translation::BEGIN); | 3222 Translation::BEGIN); |
| 3205 } | 3223 } |
| 3206 | 3224 |
| 3207 | 3225 |
| 3208 void TranslatedState::Prepare(bool has_adapted_arguments, | 3226 void TranslatedState::Prepare(bool has_adapted_arguments, |
| 3209 Address stack_frame_pointer) { | 3227 Address stack_frame_pointer) { |
| 3210 for (auto& frame : frames_) { | 3228 for (auto& frame : frames_) frame.Handlify(); |
| 3211 frame.Handlify(isolate_); | |
| 3212 } | |
| 3213 | 3229 |
| 3214 stack_frame_pointer_ = stack_frame_pointer; | 3230 stack_frame_pointer_ = stack_frame_pointer; |
| 3215 has_adapted_arguments_ = has_adapted_arguments; | 3231 has_adapted_arguments_ = has_adapted_arguments; |
| 3216 | 3232 |
| 3217 UpdateFromPreviouslyMaterializedObjects(); | 3233 UpdateFromPreviouslyMaterializedObjects(); |
| 3218 } | 3234 } |
| 3219 | 3235 |
| 3220 | 3236 |
| 3221 Handle<Object> TranslatedState::MaterializeAt(int frame_index, | 3237 Handle<Object> TranslatedState::MaterializeAt(int frame_index, |
| 3222 int* value_index) { | 3238 int* value_index) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3242 | 3258 |
| 3243 case TranslatedValue::kArgumentsObject: { | 3259 case TranslatedValue::kArgumentsObject: { |
| 3244 int length = slot->GetChildrenCount(); | 3260 int length = slot->GetChildrenCount(); |
| 3245 Handle<JSObject> arguments; | 3261 Handle<JSObject> arguments; |
| 3246 if (GetAdaptedArguments(&arguments, frame_index)) { | 3262 if (GetAdaptedArguments(&arguments, frame_index)) { |
| 3247 // Store the materialized object and consume the nested values. | 3263 // Store the materialized object and consume the nested values. |
| 3248 for (int i = 0; i < length; ++i) { | 3264 for (int i = 0; i < length; ++i) { |
| 3249 MaterializeAt(frame_index, value_index); | 3265 MaterializeAt(frame_index, value_index); |
| 3250 } | 3266 } |
| 3251 } else { | 3267 } else { |
| 3252 Handle<JSFunction> function = frame->function(); | 3268 Handle<JSFunction> function = |
| 3269 Handle<JSFunction>::cast(frame->front().GetValue()); |
| 3253 arguments = isolate_->factory()->NewArgumentsObject(function, length); | 3270 arguments = isolate_->factory()->NewArgumentsObject(function, length); |
| 3254 Handle<FixedArray> array = isolate_->factory()->NewFixedArray(length); | 3271 Handle<FixedArray> array = isolate_->factory()->NewFixedArray(length); |
| 3255 DCHECK_EQ(array->length(), length); | 3272 DCHECK_EQ(array->length(), length); |
| 3256 arguments->set_elements(*array); | 3273 arguments->set_elements(*array); |
| 3257 for (int i = 0; i < length; ++i) { | 3274 for (int i = 0; i < length; ++i) { |
| 3258 Handle<Object> value = MaterializeAt(frame_index, value_index); | 3275 Handle<Object> value = MaterializeAt(frame_index, value_index); |
| 3259 array->set(i, *value); | 3276 array->set(i, *value); |
| 3260 } | 3277 } |
| 3261 } | 3278 } |
| 3262 slot->value_ = arguments; | 3279 slot->value_ = arguments; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3373 | 3390 |
| 3374 bool TranslatedState::GetAdaptedArguments(Handle<JSObject>* result, | 3391 bool TranslatedState::GetAdaptedArguments(Handle<JSObject>* result, |
| 3375 int frame_index) { | 3392 int frame_index) { |
| 3376 if (frame_index == 0) { | 3393 if (frame_index == 0) { |
| 3377 // Top level frame -> we need to go to the parent frame on the stack. | 3394 // Top level frame -> we need to go to the parent frame on the stack. |
| 3378 if (!has_adapted_arguments_) return false; | 3395 if (!has_adapted_arguments_) return false; |
| 3379 | 3396 |
| 3380 // This is top level frame, so we need to go to the stack to get | 3397 // This is top level frame, so we need to go to the stack to get |
| 3381 // this function's argument. (Note that this relies on not inlining | 3398 // this function's argument. (Note that this relies on not inlining |
| 3382 // recursive functions!) | 3399 // recursive functions!) |
| 3383 Handle<JSFunction> function = frames_[frame_index].function(); | 3400 Handle<JSFunction> function = |
| 3401 Handle<JSFunction>::cast(frames_[frame_index].front().GetValue()); |
| 3384 *result = Handle<JSObject>::cast(Accessors::FunctionGetArguments(function)); | 3402 *result = Handle<JSObject>::cast(Accessors::FunctionGetArguments(function)); |
| 3385 return true; | 3403 return true; |
| 3386 } else { | 3404 } else { |
| 3387 TranslatedFrame* previous_frame = &(frames_[frame_index]); | 3405 TranslatedFrame* previous_frame = &(frames_[frame_index]); |
| 3388 if (previous_frame->kind() != TranslatedFrame::kArgumentsAdaptor) { | 3406 if (previous_frame->kind() != TranslatedFrame::kArgumentsAdaptor) { |
| 3389 return false; | 3407 return false; |
| 3390 } | 3408 } |
| 3391 // We get the adapted arguments from the parent translation. | 3409 // We get the adapted arguments from the parent translation. |
| 3392 int length = previous_frame->GetValueCount(); | 3410 int length = previous_frame->height(); |
| 3393 Handle<JSFunction> function = previous_frame->function(); | 3411 Handle<JSFunction> function = |
| 3412 Handle<JSFunction>::cast(previous_frame->front().GetValue()); |
| 3394 Handle<JSObject> arguments = | 3413 Handle<JSObject> arguments = |
| 3395 isolate_->factory()->NewArgumentsObject(function, length); | 3414 isolate_->factory()->NewArgumentsObject(function, length); |
| 3396 Handle<FixedArray> array = isolate_->factory()->NewFixedArray(length); | 3415 Handle<FixedArray> array = isolate_->factory()->NewFixedArray(length); |
| 3397 arguments->set_elements(*array); | 3416 arguments->set_elements(*array); |
| 3398 TranslatedFrame::iterator arg_iterator = previous_frame->begin(); | 3417 TranslatedFrame::iterator arg_iterator = previous_frame->begin(); |
| 3418 arg_iterator++; // Skip function. |
| 3399 for (int i = 0; i < length; ++i) { | 3419 for (int i = 0; i < length; ++i) { |
| 3400 Handle<Object> value = arg_iterator->GetValue(); | 3420 Handle<Object> value = arg_iterator->GetValue(); |
| 3401 array->set(i, *value); | 3421 array->set(i, *value); |
| 3402 arg_iterator++; | 3422 arg_iterator++; |
| 3403 } | 3423 } |
| 3404 CHECK(arg_iterator == previous_frame->end()); | 3424 CHECK(arg_iterator == previous_frame->end()); |
| 3405 *result = arguments; | 3425 *result = arguments; |
| 3406 return true; | 3426 return true; |
| 3407 } | 3427 } |
| 3408 } | 3428 } |
| 3409 | 3429 |
| 3410 | 3430 |
| 3411 TranslatedFrame* TranslatedState::GetArgumentsInfoFromJSFrameIndex( | 3431 TranslatedFrame* TranslatedState::GetArgumentsInfoFromJSFrameIndex( |
| 3412 int jsframe_index, int* args_count) { | 3432 int jsframe_index, int* args_count) { |
| 3413 for (size_t i = 0; i < frames_.size(); i++) { | 3433 for (size_t i = 0; i < frames_.size(); i++) { |
| 3414 if (frames_[i].kind() == TranslatedFrame::kFunction) { | 3434 if (frames_[i].kind() == TranslatedFrame::kFunction) { |
| 3415 if (jsframe_index > 0) { | 3435 if (jsframe_index > 0) { |
| 3416 jsframe_index--; | 3436 jsframe_index--; |
| 3417 } else { | 3437 } else { |
| 3418 // We have the JS function frame, now check if it has arguments adaptor. | 3438 // We have the JS function frame, now check if it has arguments adaptor. |
| 3419 if (i > 0 && | 3439 if (i > 0 && |
| 3420 frames_[i - 1].kind() == TranslatedFrame::kArgumentsAdaptor) { | 3440 frames_[i - 1].kind() == TranslatedFrame::kArgumentsAdaptor) { |
| 3421 *args_count = frames_[i - 1].height(); | 3441 *args_count = frames_[i - 1].height(); |
| 3422 return &(frames_[i - 1]); | 3442 return &(frames_[i - 1]); |
| 3423 } | 3443 } |
| 3424 *args_count = | 3444 *args_count = |
| 3425 frames_[i].function()->shared()->internal_formal_parameter_count() + | 3445 frames_[i].shared_info()->internal_formal_parameter_count() + 1; |
| 3426 1; | |
| 3427 return &(frames_[i]); | 3446 return &(frames_[i]); |
| 3428 } | 3447 } |
| 3429 } | 3448 } |
| 3430 } | 3449 } |
| 3431 return nullptr; | 3450 return nullptr; |
| 3432 } | 3451 } |
| 3433 | 3452 |
| 3434 | 3453 |
| 3435 void TranslatedState::StoreMaterializedValuesAndDeopt() { | 3454 void TranslatedState::StoreMaterializedValuesAndDeopt() { |
| 3436 MaterializedObjectStore* materialized_store = | 3455 MaterializedObjectStore* materialized_store = |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3468 previously_materialized_objects->set(i, *value); | 3487 previously_materialized_objects->set(i, *value); |
| 3469 value_changed = true; | 3488 value_changed = true; |
| 3470 } else { | 3489 } else { |
| 3471 DCHECK(previously_materialized_objects->get(i) == *value); | 3490 DCHECK(previously_materialized_objects->get(i) == *value); |
| 3472 } | 3491 } |
| 3473 } | 3492 } |
| 3474 } | 3493 } |
| 3475 if (new_store && value_changed) { | 3494 if (new_store && value_changed) { |
| 3476 materialized_store->Set(stack_frame_pointer_, | 3495 materialized_store->Set(stack_frame_pointer_, |
| 3477 previously_materialized_objects); | 3496 previously_materialized_objects); |
| 3478 DCHECK(frames_[0].kind() == TranslatedFrame::kFunction); | 3497 DCHECK_EQ(TranslatedFrame::kFunction, frames_[0].kind()); |
| 3479 Deoptimizer::DeoptimizeFunction(*(frames_[0].function())); | 3498 Object* const function = frames_[0].front().GetRawValue(); |
| 3499 Deoptimizer::DeoptimizeFunction(JSFunction::cast(function)); |
| 3480 } | 3500 } |
| 3481 } | 3501 } |
| 3482 | 3502 |
| 3483 | 3503 |
| 3484 void TranslatedState::UpdateFromPreviouslyMaterializedObjects() { | 3504 void TranslatedState::UpdateFromPreviouslyMaterializedObjects() { |
| 3485 MaterializedObjectStore* materialized_store = | 3505 MaterializedObjectStore* materialized_store = |
| 3486 isolate_->materialized_object_store(); | 3506 isolate_->materialized_object_store(); |
| 3487 Handle<FixedArray> previously_materialized_objects = | 3507 Handle<FixedArray> previously_materialized_objects = |
| 3488 materialized_store->Get(stack_frame_pointer_); | 3508 materialized_store->Get(stack_frame_pointer_); |
| 3489 | 3509 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3505 DCHECK(value_info->IsMaterializedObject()); | 3525 DCHECK(value_info->IsMaterializedObject()); |
| 3506 | 3526 |
| 3507 value_info->value_ = | 3527 value_info->value_ = |
| 3508 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 3528 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
| 3509 } | 3529 } |
| 3510 } | 3530 } |
| 3511 } | 3531 } |
| 3512 | 3532 |
| 3513 } // namespace internal | 3533 } // namespace internal |
| 3514 } // namespace v8 | 3534 } // namespace v8 |
| OLD | NEW |