| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
| 11 #include "src/interpreter/bytecode-array-iterator.h" | 11 #include "src/interpreter/bytecode-array-iterator.h" |
| 12 #include "src/interpreter/bytecodes.h" | 12 #include "src/interpreter/bytecodes.h" |
| 13 #include "src/isolate-inl.h" | 13 #include "src/isolate-inl.h" |
| 14 #include "src/ostreams.h" | 14 #include "src/ostreams.h" |
| 15 | 15 |
| 16 namespace v8 { | 16 namespace v8 { |
| 17 namespace internal { | 17 namespace internal { |
| 18 | 18 |
| 19 | |
| 20 RUNTIME_FUNCTION(Runtime_InterpreterEquals) { | |
| 21 HandleScope scope(isolate); | |
| 22 DCHECK_EQ(2, args.length()); | |
| 23 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
| 24 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
| 25 Maybe<bool> result = Object::Equals(x, y); | |
| 26 if (result.IsJust()) { | |
| 27 return isolate->heap()->ToBoolean(result.FromJust()); | |
| 28 } else { | |
| 29 return isolate->heap()->exception(); | |
| 30 } | |
| 31 } | |
| 32 | |
| 33 | |
| 34 RUNTIME_FUNCTION(Runtime_InterpreterNotEquals) { | |
| 35 HandleScope scope(isolate); | |
| 36 DCHECK_EQ(2, args.length()); | |
| 37 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
| 38 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
| 39 Maybe<bool> result = Object::Equals(x, y); | |
| 40 if (result.IsJust()) { | |
| 41 return isolate->heap()->ToBoolean(!result.FromJust()); | |
| 42 } else { | |
| 43 return isolate->heap()->exception(); | |
| 44 } | |
| 45 } | |
| 46 | |
| 47 | |
| 48 RUNTIME_FUNCTION(Runtime_InterpreterLessThan) { | |
| 49 HandleScope scope(isolate); | |
| 50 DCHECK_EQ(2, args.length()); | |
| 51 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
| 52 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
| 53 Maybe<bool> result = Object::LessThan(x, y); | |
| 54 if (result.IsJust()) { | |
| 55 return isolate->heap()->ToBoolean(result.FromJust()); | |
| 56 } else { | |
| 57 return isolate->heap()->exception(); | |
| 58 } | |
| 59 } | |
| 60 | |
| 61 | |
| 62 RUNTIME_FUNCTION(Runtime_InterpreterGreaterThan) { | |
| 63 HandleScope scope(isolate); | |
| 64 DCHECK_EQ(2, args.length()); | |
| 65 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
| 66 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
| 67 Maybe<bool> result = Object::GreaterThan(x, y); | |
| 68 if (result.IsJust()) { | |
| 69 return isolate->heap()->ToBoolean(result.FromJust()); | |
| 70 } else { | |
| 71 return isolate->heap()->exception(); | |
| 72 } | |
| 73 } | |
| 74 | |
| 75 | |
| 76 RUNTIME_FUNCTION(Runtime_InterpreterLessThanOrEqual) { | |
| 77 HandleScope scope(isolate); | |
| 78 DCHECK_EQ(2, args.length()); | |
| 79 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
| 80 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
| 81 Maybe<bool> result = Object::LessThanOrEqual(x, y); | |
| 82 if (result.IsJust()) { | |
| 83 return isolate->heap()->ToBoolean(result.FromJust()); | |
| 84 } else { | |
| 85 return isolate->heap()->exception(); | |
| 86 } | |
| 87 } | |
| 88 | |
| 89 | |
| 90 RUNTIME_FUNCTION(Runtime_InterpreterGreaterThanOrEqual) { | |
| 91 HandleScope scope(isolate); | |
| 92 DCHECK_EQ(2, args.length()); | |
| 93 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
| 94 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
| 95 Maybe<bool> result = Object::GreaterThanOrEqual(x, y); | |
| 96 if (result.IsJust()) { | |
| 97 return isolate->heap()->ToBoolean(result.FromJust()); | |
| 98 } else { | |
| 99 return isolate->heap()->exception(); | |
| 100 } | |
| 101 } | |
| 102 | |
| 103 | |
| 104 RUNTIME_FUNCTION(Runtime_InterpreterStrictEquals) { | |
| 105 SealHandleScope shs(isolate); | |
| 106 DCHECK_EQ(2, args.length()); | |
| 107 CONVERT_ARG_CHECKED(Object, x, 0); | |
| 108 CONVERT_ARG_CHECKED(Object, y, 1); | |
| 109 return isolate->heap()->ToBoolean(x->StrictEquals(y)); | |
| 110 } | |
| 111 | |
| 112 | |
| 113 RUNTIME_FUNCTION(Runtime_InterpreterStrictNotEquals) { | |
| 114 SealHandleScope shs(isolate); | |
| 115 DCHECK_EQ(2, args.length()); | |
| 116 CONVERT_ARG_CHECKED(Object, x, 0); | |
| 117 CONVERT_ARG_CHECKED(Object, y, 1); | |
| 118 return isolate->heap()->ToBoolean(!x->StrictEquals(y)); | |
| 119 } | |
| 120 | |
| 121 | |
| 122 RUNTIME_FUNCTION(Runtime_InterpreterToBoolean) { | 19 RUNTIME_FUNCTION(Runtime_InterpreterToBoolean) { |
| 123 SealHandleScope shs(isolate); | 20 SealHandleScope shs(isolate); |
| 124 DCHECK_EQ(1, args.length()); | 21 DCHECK_EQ(1, args.length()); |
| 125 CONVERT_ARG_CHECKED(Object, x, 0); | 22 CONVERT_ARG_CHECKED(Object, x, 0); |
| 126 return isolate->heap()->ToBoolean(x->BooleanValue()); | 23 return isolate->heap()->ToBoolean(x->BooleanValue()); |
| 127 } | 24 } |
| 128 | 25 |
| 129 | 26 |
| 130 RUNTIME_FUNCTION(Runtime_InterpreterLogicalNot) { | 27 RUNTIME_FUNCTION(Runtime_InterpreterLogicalNot) { |
| 131 SealHandleScope shs(isolate); | 28 SealHandleScope shs(isolate); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { | 162 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { |
| 266 SealHandleScope shs(isolate); | 163 SealHandleScope shs(isolate); |
| 267 DCHECK_EQ(1, args.length()); | 164 DCHECK_EQ(1, args.length()); |
| 268 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0); | 165 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0); |
| 269 isolate->thread_local_top()->pending_message_obj_ = *message; | 166 isolate->thread_local_top()->pending_message_obj_ = *message; |
| 270 return isolate->heap()->undefined_value(); | 167 return isolate->heap()->undefined_value(); |
| 271 } | 168 } |
| 272 | 169 |
| 273 } // namespace internal | 170 } // namespace internal |
| 274 } // namespace v8 | 171 } // namespace v8 |
| OLD | NEW |