Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 7786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7797 if (y == 0) { | 7797 if (y == 0) { |
| 7798 return Smi::FromInt(1); | 7798 return Smi::FromInt(1); |
| 7799 } else { | 7799 } else { |
| 7800 double result = power_double_double(x, y); | 7800 double result = power_double_double(x, y); |
| 7801 if (std::isnan(result)) return isolate->heap()->nan_value(); | 7801 if (std::isnan(result)) return isolate->heap()->nan_value(); |
| 7802 return *isolate->factory()->NewNumber(result); | 7802 return *isolate->factory()->NewNumber(result); |
| 7803 } | 7803 } |
| 7804 } | 7804 } |
| 7805 | 7805 |
| 7806 | 7806 |
| 7807 RUNTIME_FUNCTION(Runtime_IsConstructor) { | |
|
rossberg
2014/07/08 08:39:17
Drive-by-comment: Unfortunately, I don't think thi
rossberg
2014/07/08 09:59:09
And more importantly, for JSFunctions it is testin
| |
| 7808 HandleScope scope(isolate); | |
| 7809 ASSERT(args.length() == 1); | |
| 7810 | |
| 7811 CONVERT_ARG_CHECKED(JSFunction, obj, 0); | |
| 7812 if (!obj->IsObject()) return isolate->heap()->false_value(); | |
| 7813 bool hasConstructor = !!obj->GetConstructor(); | |
| 7814 return hasConstructor ? isolate->heap()->true_value() | |
| 7815 : isolate->heap()->false_value(); | |
| 7816 } | |
| 7817 | |
| 7818 | |
| 7807 RUNTIME_FUNCTION(Runtime_RoundNumber) { | 7819 RUNTIME_FUNCTION(Runtime_RoundNumber) { |
| 7808 HandleScope scope(isolate); | 7820 HandleScope scope(isolate); |
| 7809 ASSERT(args.length() == 1); | 7821 ASSERT(args.length() == 1); |
| 7810 CONVERT_NUMBER_ARG_HANDLE_CHECKED(input, 0); | 7822 CONVERT_NUMBER_ARG_HANDLE_CHECKED(input, 0); |
| 7811 isolate->counters()->math_round()->Increment(); | 7823 isolate->counters()->math_round()->Increment(); |
| 7812 | 7824 |
| 7813 if (!input->IsHeapNumber()) { | 7825 if (!input->IsHeapNumber()) { |
| 7814 ASSERT(input->IsSmi()); | 7826 ASSERT(input->IsSmi()); |
| 7815 return *input; | 7827 return *input; |
| 7816 } | 7828 } |
| (...skipping 7291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15108 } | 15120 } |
| 15109 return NULL; | 15121 return NULL; |
| 15110 } | 15122 } |
| 15111 | 15123 |
| 15112 | 15124 |
| 15113 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15125 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15114 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15126 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15115 } | 15127 } |
| 15116 | 15128 |
| 15117 } } // namespace v8::internal | 15129 } } // namespace v8::internal |
| OLD | NEW |