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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 8777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8788 int number_of_literals, | 8788 int number_of_literals, |
8789 PretenureFlag pretenure) { | 8789 PretenureFlag pretenure) { |
8790 Handle<FixedArray> literals = isolate->factory()->NewFixedArray( | 8790 Handle<FixedArray> literals = isolate->factory()->NewFixedArray( |
8791 number_of_literals + kFirstLiteralIndex, pretenure); | 8791 number_of_literals + kFirstLiteralIndex, pretenure); |
8792 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals); | 8792 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals); |
8793 casted_literals->set_feedback_vector(*vector); | 8793 casted_literals->set_feedback_vector(*vector); |
8794 return casted_literals; | 8794 return casted_literals; |
8795 } | 8795 } |
8796 | 8796 |
8797 | 8797 |
| 8798 // static |
| 8799 Handle<BindingsArray> BindingsArray::New(Isolate* isolate, |
| 8800 Handle<TypeFeedbackVector> vector, |
| 8801 Handle<JSReceiver> bound_function, |
| 8802 Handle<Object> bound_this, |
| 8803 int number_of_bindings) { |
| 8804 Handle<FixedArray> bindings = isolate->factory()->NewFixedArray( |
| 8805 number_of_bindings + kFirstBindingIndex); |
| 8806 Handle<BindingsArray> casted_bindings = Handle<BindingsArray>::cast(bindings); |
| 8807 casted_bindings->set_feedback_vector(*vector); |
| 8808 casted_bindings->set_bound_function(*bound_function); |
| 8809 casted_bindings->set_bound_this(*bound_this); |
| 8810 return casted_bindings; |
| 8811 } |
| 8812 |
| 8813 |
| 8814 // static |
| 8815 Handle<JSArray> BindingsArray::CreateBoundArguments( |
| 8816 Handle<BindingsArray> bindings) { |
| 8817 int bound_argument_count = bindings->bindings_count(); |
| 8818 Factory* factory = bindings->GetIsolate()->factory(); |
| 8819 Handle<FixedArray> arguments = factory->NewFixedArray(bound_argument_count); |
| 8820 bindings->CopyTo(kFirstBindingIndex, *arguments, 0, bound_argument_count); |
| 8821 return factory->NewJSArrayWithElements(arguments); |
| 8822 } |
| 8823 |
| 8824 |
| 8825 // static |
| 8826 Handle<JSArray> BindingsArray::CreateRuntimeBindings( |
| 8827 Handle<BindingsArray> bindings) { |
| 8828 Factory* factory = bindings->GetIsolate()->factory(); |
| 8829 // A runtime bindings array consists of |
| 8830 // [bound function, bound this, [arg0, arg1, ...]]. |
| 8831 Handle<FixedArray> runtime_bindings = |
| 8832 factory->NewFixedArray(2 + bindings->bindings_count()); |
| 8833 bindings->CopyTo(kBoundFunctionIndex, *runtime_bindings, 0, |
| 8834 2 + bindings->bindings_count()); |
| 8835 return factory->NewJSArrayWithElements(runtime_bindings); |
| 8836 } |
| 8837 |
| 8838 |
8798 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out, | 8839 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out, |
8799 CatchPrediction* prediction_out) { | 8840 CatchPrediction* prediction_out) { |
8800 int innermost_handler = -1, innermost_start = -1; | 8841 int innermost_handler = -1, innermost_start = -1; |
8801 for (int i = 0; i < length(); i += kRangeEntrySize) { | 8842 for (int i = 0; i < length(); i += kRangeEntrySize) { |
8802 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); | 8843 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); |
8803 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); | 8844 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); |
8804 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); | 8845 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); |
8805 int handler_offset = HandlerOffsetField::decode(handler_field); | 8846 int handler_offset = HandlerOffsetField::decode(handler_field); |
8806 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); | 8847 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); |
8807 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value(); | 8848 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value(); |
(...skipping 7993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16801 if (cell->value() != *new_value) { | 16842 if (cell->value() != *new_value) { |
16802 cell->set_value(*new_value); | 16843 cell->set_value(*new_value); |
16803 Isolate* isolate = cell->GetIsolate(); | 16844 Isolate* isolate = cell->GetIsolate(); |
16804 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16845 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16805 isolate, DependentCode::kPropertyCellChangedGroup); | 16846 isolate, DependentCode::kPropertyCellChangedGroup); |
16806 } | 16847 } |
16807 } | 16848 } |
16808 | 16849 |
16809 } // namespace internal | 16850 } // namespace internal |
16810 } // namespace v8 | 16851 } // namespace v8 |
OLD | NEW |