| 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/assembler-inl.h" | 10 #include "src/assembler-inl.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 RUNTIME_FUNCTION(Runtime_ConstructDouble) { | 65 RUNTIME_FUNCTION(Runtime_ConstructDouble) { |
| 66 HandleScope scope(isolate); | 66 HandleScope scope(isolate); |
| 67 DCHECK_EQ(2, args.length()); | 67 DCHECK_EQ(2, args.length()); |
| 68 CONVERT_NUMBER_CHECKED(uint32_t, hi, Uint32, args[0]); | 68 CONVERT_NUMBER_CHECKED(uint32_t, hi, Uint32, args[0]); |
| 69 CONVERT_NUMBER_CHECKED(uint32_t, lo, Uint32, args[1]); | 69 CONVERT_NUMBER_CHECKED(uint32_t, lo, Uint32, args[1]); |
| 70 uint64_t result = (static_cast<uint64_t>(hi) << 32) | lo; | 70 uint64_t result = (static_cast<uint64_t>(hi) << 32) | lo; |
| 71 return *isolate->factory()->NewNumber(uint64_to_double(result)); | 71 return *isolate->factory()->NewNumber(uint64_to_double(result)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 RUNTIME_FUNCTION(Runtime_ConstructConsString) { |
| 75 HandleScope scope(isolate); |
| 76 DCHECK_EQ(2, args.length()); |
| 77 CONVERT_ARG_HANDLE_CHECKED(String, left, 0); |
| 78 CONVERT_ARG_HANDLE_CHECKED(String, right, 1); |
| 79 |
| 80 CHECK(left->IsOneByteRepresentation()); |
| 81 CHECK(right->IsOneByteRepresentation()); |
| 82 |
| 83 const bool kIsOneByte = true; |
| 84 const int length = left->length() + right->length(); |
| 85 return *isolate->factory()->NewConsString(left, right, length, kIsOneByte); |
| 86 } |
| 87 |
| 74 RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { | 88 RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { |
| 75 HandleScope scope(isolate); | 89 HandleScope scope(isolate); |
| 76 DCHECK_EQ(1, args.length()); | 90 DCHECK_EQ(1, args.length()); |
| 77 | 91 |
| 78 // This function is used by fuzzers to get coverage in compiler. | 92 // This function is used by fuzzers to get coverage in compiler. |
| 79 // Ignore calls on non-function objects to avoid runtime errors. | 93 // Ignore calls on non-function objects to avoid runtime errors. |
| 80 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); | 94 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); |
| 81 if (!function_object->IsJSFunction()) { | 95 if (!function_object->IsJSFunction()) { |
| 82 return isolate->heap()->undefined_value(); | 96 return isolate->heap()->undefined_value(); |
| 83 } | 97 } |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 CHECK(HeapObject::cast(*object)->map()->IsMap()); | 931 CHECK(HeapObject::cast(*object)->map()->IsMap()); |
| 918 } else { | 932 } else { |
| 919 CHECK(object->IsSmi()); | 933 CHECK(object->IsSmi()); |
| 920 } | 934 } |
| 921 #endif | 935 #endif |
| 922 return isolate->heap()->ToBoolean(true); | 936 return isolate->heap()->ToBoolean(true); |
| 923 } | 937 } |
| 924 | 938 |
| 925 } // namespace internal | 939 } // namespace internal |
| 926 } // namespace v8 | 940 } // namespace v8 |
| OLD | NEW |