Chromium Code Reviews| 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/elements.h" | 8 #include "src/elements.h" |
| 9 #include "src/messages.h" | 9 #include "src/messages.h" |
| 10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice); | 51 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice); |
| 52 InstallBuiltin(isolate, holder, "concat", Builtins::kArrayConcat); | 52 InstallBuiltin(isolate, holder, "concat", Builtins::kArrayConcat); |
| 53 | 53 |
| 54 return *holder; | 54 return *holder; |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 RUNTIME_FUNCTION(Runtime_FixedArrayGet) { | 58 RUNTIME_FUNCTION(Runtime_FixedArrayGet) { |
| 59 SealHandleScope shs(isolate); | 59 SealHandleScope shs(isolate); |
| 60 DCHECK(args.length() == 2); | 60 DCHECK(args.length() == 2); |
| 61 CONVERT_ARG_CHECKED(FixedArray, object, 0); | 61 CONVERT_ARG_CHECKED(FixedArrayBase, object, 0); |
| 62 CONVERT_SMI_ARG_CHECKED(index, 1); | 62 CONVERT_SMI_ARG_CHECKED(index, 1); |
| 63 return object->get(index); | 63 if (object->IsTypeFeedbackVector()) { |
| 64 return TypeFeedbackVector::cast(object)->get(index); | |
|
Hannes Payer (out of office)
2015/07/01 09:44:36
The type feedback vector should actually have to s
| |
| 65 } | |
| 66 return FixedArray::cast(object)->get(index); | |
| 64 } | 67 } |
| 65 | 68 |
| 66 | 69 |
| 67 RUNTIME_FUNCTION(Runtime_FixedArraySet) { | 70 RUNTIME_FUNCTION(Runtime_FixedArraySet) { |
| 68 SealHandleScope shs(isolate); | 71 SealHandleScope shs(isolate); |
| 69 DCHECK(args.length() == 3); | 72 DCHECK(args.length() == 3); |
| 70 CONVERT_ARG_CHECKED(FixedArray, object, 0); | 73 CONVERT_ARG_CHECKED(FixedArrayBase, object, 0); |
| 71 CONVERT_SMI_ARG_CHECKED(index, 1); | 74 CONVERT_SMI_ARG_CHECKED(index, 1); |
| 72 CONVERT_ARG_CHECKED(Object, value, 2); | 75 CONVERT_ARG_CHECKED(Object, value, 2); |
| 73 object->set(index, value); | 76 if (object->IsTypeFeedbackVector()) { |
| 77 TypeFeedbackVector::cast(object)->set(index, value); | |
| 78 } else { | |
| 79 FixedArray::cast(object)->set(index, value); | |
| 80 } | |
| 74 return isolate->heap()->undefined_value(); | 81 return isolate->heap()->undefined_value(); |
| 75 } | 82 } |
| 76 | 83 |
| 77 | 84 |
| 78 RUNTIME_FUNCTION(Runtime_TransitionElementsKind) { | 85 RUNTIME_FUNCTION(Runtime_TransitionElementsKind) { |
| 79 HandleScope scope(isolate); | 86 HandleScope scope(isolate); |
| 80 RUNTIME_ASSERT(args.length() == 2); | 87 RUNTIME_ASSERT(args.length() == 2); |
| 81 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); | 88 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); |
| 82 CONVERT_ARG_HANDLE_CHECKED(Map, map, 1); | 89 CONVERT_ARG_HANDLE_CHECKED(Map, map, 1); |
| 83 JSObject::TransitionElementsKind(array, map->elements_kind()); | 90 JSObject::TransitionElementsKind(array, map->elements_kind()); |
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1317 | 1324 |
| 1318 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { | 1325 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { |
| 1319 SealHandleScope shs(isolate); | 1326 SealHandleScope shs(isolate); |
| 1320 DCHECK(args.length() == 2); | 1327 DCHECK(args.length() == 2); |
| 1321 // Returning undefined means that this fast path fails and one has to resort | 1328 // Returning undefined means that this fast path fails and one has to resort |
| 1322 // to a slow path. | 1329 // to a slow path. |
| 1323 return isolate->heap()->undefined_value(); | 1330 return isolate->heap()->undefined_value(); |
| 1324 } | 1331 } |
| 1325 } // namespace internal | 1332 } // namespace internal |
| 1326 } // namespace v8 | 1333 } // namespace v8 |
| OLD | NEW |