| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/messages.h" | 8 #include "src/messages.h" |
| 9 #include "src/runtime/runtime-utils.h" | 9 #include "src/runtime/runtime-utils.h" |
| 10 | 10 |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 | 1227 |
| 1228 if (key < 0) { | 1228 if (key < 0) { |
| 1229 return object->elements(); | 1229 return object->elements(); |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 uint32_t capacity = static_cast<uint32_t>(object->elements()->length()); | 1232 uint32_t capacity = static_cast<uint32_t>(object->elements()->length()); |
| 1233 uint32_t index = static_cast<uint32_t>(key); | 1233 uint32_t index = static_cast<uint32_t>(key); |
| 1234 | 1234 |
| 1235 if (index >= capacity) { | 1235 if (index >= capacity) { |
| 1236 if (object->WouldConvertToSlowElements(index)) { | 1236 if (object->WouldConvertToSlowElements(index)) { |
| 1237 JSObject::NormalizeElements(object); | 1237 // We don't want to allow operations that cause lazy deopt. Return a Smi |
| 1238 // as a signal that optimized code should eagerly deoptimize. |
| 1238 return Smi::FromInt(0); | 1239 return Smi::FromInt(0); |
| 1239 } | 1240 } |
| 1240 | 1241 |
| 1241 uint32_t new_capacity = JSObject::NewElementsCapacity(index + 1); | 1242 uint32_t new_capacity = JSObject::NewElementsCapacity(index + 1); |
| 1242 ElementsKind kind = object->GetElementsKind(); | 1243 ElementsKind kind = object->GetElementsKind(); |
| 1243 if (IsFastDoubleElementsKind(kind)) { | 1244 if (IsFastDoubleElementsKind(kind)) { |
| 1244 JSObject::SetFastDoubleElementsCapacity(object, new_capacity); | 1245 JSObject::SetFastDoubleElementsCapacity(object, new_capacity); |
| 1245 } else { | 1246 } else { |
| 1246 JSObject::SetFastElementsCapacitySmiMode set_capacity_mode = | 1247 JSObject::SetFastElementsCapacitySmiMode set_capacity_mode = |
| 1247 object->HasFastSmiElements() ? JSObject::kAllowSmiElements | 1248 object->HasFastSmiElements() ? JSObject::kAllowSmiElements |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 | 1393 |
| 1393 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { | 1394 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { |
| 1394 SealHandleScope shs(isolate); | 1395 SealHandleScope shs(isolate); |
| 1395 DCHECK(args.length() == 2); | 1396 DCHECK(args.length() == 2); |
| 1396 // Returning undefined means that this fast path fails and one has to resort | 1397 // Returning undefined means that this fast path fails and one has to resort |
| 1397 // to a slow path. | 1398 // to a slow path. |
| 1398 return isolate->heap()->undefined_value(); | 1399 return isolate->heap()->undefined_value(); |
| 1399 } | 1400 } |
| 1400 } | 1401 } |
| 1401 } // namespace v8::internal | 1402 } // namespace v8::internal |
| OLD | NEW |