OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/constant-array-builder.h" | 5 #include "src/interpreter/constant-array-builder.h" |
6 | 6 |
7 #include "src/isolate.h" | 7 #include "src/isolate.h" |
8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 STATIC_CONST_MEMBER_DEFINITION const size_t | 52 STATIC_CONST_MEMBER_DEFINITION const size_t |
53 ConstantArrayBuilder::k32BitCapacity; | 53 ConstantArrayBuilder::k32BitCapacity; |
54 | 54 |
55 ConstantArrayBuilder::ConstantArrayBuilder(Isolate* isolate, Zone* zone) | 55 ConstantArrayBuilder::ConstantArrayBuilder(Isolate* isolate, Zone* zone) |
56 : isolate_(isolate), constants_map_(isolate->heap(), zone) { | 56 : isolate_(isolate), constants_map_(isolate->heap(), zone) { |
57 idx_slice_[0] = | 57 idx_slice_[0] = |
58 new (zone) ConstantArraySlice(zone, 0, k8BitCapacity, OperandSize::kByte); | 58 new (zone) ConstantArraySlice(zone, 0, k8BitCapacity, OperandSize::kByte); |
59 idx_slice_[1] = new (zone) ConstantArraySlice( | 59 idx_slice_[1] = new (zone) ConstantArraySlice( |
60 zone, k8BitCapacity, k16BitCapacity, OperandSize::kShort); | 60 zone, k8BitCapacity, k16BitCapacity, OperandSize::kShort); |
61 idx_slice_[2] = new (zone) ConstantArraySlice( | 61 idx_slice_[2] = new (zone) ConstantArraySlice( |
62 zone, k16BitCapacity, k32BitCapacity, OperandSize::kQuad); | 62 zone, k8BitCapacity + k16BitCapacity, k32BitCapacity, OperandSize::kQuad); |
mythria
2016/04/01 10:10:42
This also fixes a clusterfuzz bug. https://bugs.ch
| |
63 } | 63 } |
64 | 64 |
65 size_t ConstantArrayBuilder::size() const { | 65 size_t ConstantArrayBuilder::size() const { |
66 size_t i = arraysize(idx_slice_); | 66 size_t i = arraysize(idx_slice_); |
67 while (i > 0) { | 67 while (i > 0) { |
68 ConstantArraySlice* slice = idx_slice_[--i]; | 68 ConstantArraySlice* slice = idx_slice_[--i]; |
69 if (slice->size() > 0) { | 69 if (slice->size() > 0) { |
70 return slice->start_index() + slice->size(); | 70 return slice->start_index() + slice->size(); |
71 } | 71 } |
72 } | 72 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 return index; | 194 return index; |
195 } | 195 } |
196 | 196 |
197 void ConstantArrayBuilder::DiscardReservedEntry(OperandSize operand_size) { | 197 void ConstantArrayBuilder::DiscardReservedEntry(OperandSize operand_size) { |
198 OperandSizeToSlice(operand_size)->Unreserve(); | 198 OperandSizeToSlice(operand_size)->Unreserve(); |
199 } | 199 } |
200 | 200 |
201 } // namespace interpreter | 201 } // namespace interpreter |
202 } // namespace internal | 202 } // namespace internal |
203 } // namespace v8 | 203 } // namespace v8 |
OLD | NEW |