| 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/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 HandleScope scope(isolate); | 53 HandleScope scope(isolate); |
| 54 DCHECK(args.length() == 2); | 54 DCHECK(args.length() == 2); |
| 55 CONVERT_NUMBER_CHECKED(uint32_t, hi, Uint32, args[0]); | 55 CONVERT_NUMBER_CHECKED(uint32_t, hi, Uint32, args[0]); |
| 56 CONVERT_NUMBER_CHECKED(uint32_t, lo, Uint32, args[1]); | 56 CONVERT_NUMBER_CHECKED(uint32_t, lo, Uint32, args[1]); |
| 57 uint64_t result = (static_cast<uint64_t>(hi) << 32) | lo; | 57 uint64_t result = (static_cast<uint64_t>(hi) << 32) | lo; |
| 58 return *isolate->factory()->NewNumber(uint64_to_double(result)); | 58 return *isolate->factory()->NewNumber(uint64_to_double(result)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 RUNTIME_FUNCTION(Runtime_RemPiO2) { | 62 RUNTIME_FUNCTION(Runtime_RemPiO2) { |
| 63 HandleScope handle_scope(isolate); | 63 SealHandleScope shs(isolate); |
| 64 DCHECK(args.length() == 1); | 64 DisallowHeapAllocation no_gc; |
| 65 DCHECK(args.length() == 2); |
| 65 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 66 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 66 Factory* factory = isolate->factory(); | 67 CONVERT_ARG_CHECKED(JSTypedArray, result, 1); |
| 67 double y[2] = {0.0, 0.0}; | 68 RUNTIME_ASSERT(result->byte_length() == Smi::FromInt(2 * sizeof(double))); |
| 68 int n = fdlibm::rempio2(x, y); | 69 void* backing_store = JSArrayBuffer::cast(result->buffer())->backing_store(); |
| 69 Handle<FixedArray> array = factory->NewFixedArray(3); | 70 double* y = static_cast<double*>(backing_store); |
| 70 Handle<HeapNumber> y0 = factory->NewHeapNumber(y[0]); | 71 return Smi::FromInt(fdlibm::rempio2(x, y)); |
| 71 Handle<HeapNumber> y1 = factory->NewHeapNumber(y[1]); | |
| 72 array->set(0, Smi::FromInt(n)); | |
| 73 array->set(1, *y0); | |
| 74 array->set(2, *y1); | |
| 75 return *factory->NewJSArrayWithElements(array); | |
| 76 } | 72 } |
| 77 | 73 |
| 78 | 74 |
| 79 static const double kPiDividedBy4 = 0.78539816339744830962; | 75 static const double kPiDividedBy4 = 0.78539816339744830962; |
| 80 | 76 |
| 81 | 77 |
| 82 RUNTIME_FUNCTION(Runtime_MathAtan2) { | 78 RUNTIME_FUNCTION(Runtime_MathAtan2) { |
| 83 HandleScope scope(isolate); | 79 HandleScope scope(isolate); |
| 84 DCHECK(args.length() == 2); | 80 DCHECK(args.length() == 2); |
| 85 isolate->counters()->math_atan2()->Increment(); | 81 isolate->counters()->math_atan2()->Increment(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 RUNTIME_FUNCTION(RuntimeReference_IsMinusZero) { | 233 RUNTIME_FUNCTION(RuntimeReference_IsMinusZero) { |
| 238 SealHandleScope shs(isolate); | 234 SealHandleScope shs(isolate); |
| 239 DCHECK(args.length() == 1); | 235 DCHECK(args.length() == 1); |
| 240 CONVERT_ARG_CHECKED(Object, obj, 0); | 236 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 241 if (!obj->IsHeapNumber()) return isolate->heap()->false_value(); | 237 if (!obj->IsHeapNumber()) return isolate->heap()->false_value(); |
| 242 HeapNumber* number = HeapNumber::cast(obj); | 238 HeapNumber* number = HeapNumber::cast(obj); |
| 243 return isolate->heap()->ToBoolean(IsMinusZero(number->value())); | 239 return isolate->heap()->ToBoolean(IsMinusZero(number->value())); |
| 244 } | 240 } |
| 245 } | 241 } |
| 246 } // namespace v8::internal | 242 } // namespace v8::internal |
| OLD | NEW |