| 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 6991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7002 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7002 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7003 CONVERT_DOUBLE_ARG_CHECKED(y, 1); | 7003 CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
| 7004 return *isolate->factory()->NewNumber(modulo(x, y)); | 7004 return *isolate->factory()->NewNumber(modulo(x, y)); |
| 7005 } | 7005 } |
| 7006 | 7006 |
| 7007 | 7007 |
| 7008 RUNTIME_FUNCTION(Runtime_NumberImul) { | 7008 RUNTIME_FUNCTION(Runtime_NumberImul) { |
| 7009 HandleScope scope(isolate); | 7009 HandleScope scope(isolate); |
| 7010 ASSERT(args.length() == 2); | 7010 ASSERT(args.length() == 2); |
| 7011 | 7011 |
| 7012 CONVERT_NUMBER_CHECKED(int32_t, x, Int32, args[0]); | 7012 // We rely on implementation-defined behavior below, but at least not on |
| 7013 CONVERT_NUMBER_CHECKED(int32_t, y, Int32, args[1]); | 7013 // undefined behavior. |
| 7014 return *isolate->factory()->NewNumberFromInt(x * y); | 7014 CONVERT_NUMBER_CHECKED(uint32_t, x, Int32, args[0]); |
| 7015 CONVERT_NUMBER_CHECKED(uint32_t, y, Int32, args[1]); |
| 7016 int32_t product = static_cast<int32_t>(x * y); |
| 7017 return *isolate->factory()->NewNumberFromInt(product); |
| 7015 } | 7018 } |
| 7016 | 7019 |
| 7017 | 7020 |
| 7018 RUNTIME_FUNCTION(Runtime_StringAdd) { | 7021 RUNTIME_FUNCTION(Runtime_StringAdd) { |
| 7019 HandleScope scope(isolate); | 7022 HandleScope scope(isolate); |
| 7020 ASSERT(args.length() == 2); | 7023 ASSERT(args.length() == 2); |
| 7021 CONVERT_ARG_HANDLE_CHECKED(String, str1, 0); | 7024 CONVERT_ARG_HANDLE_CHECKED(String, str1, 0); |
| 7022 CONVERT_ARG_HANDLE_CHECKED(String, str2, 1); | 7025 CONVERT_ARG_HANDLE_CHECKED(String, str2, 1); |
| 7023 isolate->counters()->string_add_runtime()->Increment(); | 7026 isolate->counters()->string_add_runtime()->Increment(); |
| 7024 Handle<String> result; | 7027 Handle<String> result; |
| (...skipping 8080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15105 } | 15108 } |
| 15106 return NULL; | 15109 return NULL; |
| 15107 } | 15110 } |
| 15108 | 15111 |
| 15109 | 15112 |
| 15110 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15113 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15111 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15114 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15112 } | 15115 } |
| 15113 | 15116 |
| 15114 } } // namespace v8::internal | 15117 } } // namespace v8::internal |
| OLD | NEW |