Chromium Code Reviews| Index: src/runtime/runtime-maths.cc |
| diff --git a/src/runtime/runtime-maths.cc b/src/runtime/runtime-maths.cc |
| index 6397ad15de9aaedff245e09a3c1356a701ace8c1..3e02e424db1816bf067e12bae77dd182126b855a 100644 |
| --- a/src/runtime/runtime-maths.cc |
| +++ b/src/runtime/runtime-maths.cc |
| @@ -60,19 +60,16 @@ RUNTIME_FUNCTION(Runtime_ConstructDouble) { |
| RUNTIME_FUNCTION(Runtime_RemPiO2) { |
| - HandleScope handle_scope(isolate); |
| - DCHECK(args.length() == 1); |
| + SealHandleScope shs(isolate); |
| + DisallowHeapAllocation no_gc; |
| + DCHECK(args.length() == 2); |
| CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| - Factory* factory = isolate->factory(); |
| - double y[2] = {0.0, 0.0}; |
| + CONVERT_ARG_CHECKED(JSTypedArray, result, 1); |
| + RUNTIME_ASSERT(result->byte_length() == Smi::FromInt(2 * sizeof(double))); |
| + void* backing_store = JSArrayBuffer::cast(result->buffer())->backing_store(); |
| + double* y = reinterpret_cast<double*>(backing_store); |
|
Sven Panne
2015/02/06 07:37:28
A static_cast is enough here and a smaller sledgeh
|
| int n = fdlibm::rempio2(x, y); |
| - Handle<FixedArray> array = factory->NewFixedArray(3); |
| - Handle<HeapNumber> y0 = factory->NewHeapNumber(y[0]); |
| - Handle<HeapNumber> y1 = factory->NewHeapNumber(y[1]); |
| - array->set(0, Smi::FromInt(n)); |
| - array->set(1, *y0); |
| - array->set(2, *y1); |
| - return *factory->NewJSArrayWithElements(array); |
| + return Smi::FromInt(n); |
|
Sven Panne
2015/02/06 07:37:28
Just inline "n", its name is not that helpful, any
|
| } |