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) { | 19 RUNTIME_FUNCTION(Runtime_InterpreterLessThan) { |
49 HandleScope scope(isolate); | 20 HandleScope scope(isolate); |
50 DCHECK_EQ(2, args.length()); | 21 DCHECK_EQ(2, args.length()); |
51 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | 22 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); |
52 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | 23 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); |
53 Maybe<bool> result = Object::LessThan(x, y); | 24 Maybe<bool> result = Object::LessThan(x, y); |
54 if (result.IsJust()) { | 25 if (result.IsJust()) { |
55 return isolate->heap()->ToBoolean(result.FromJust()); | 26 return isolate->heap()->ToBoolean(result.FromJust()); |
56 } else { | 27 } else { |
57 return isolate->heap()->exception(); | 28 return isolate->heap()->exception(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | 65 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); |
95 Maybe<bool> result = Object::GreaterThanOrEqual(x, y); | 66 Maybe<bool> result = Object::GreaterThanOrEqual(x, y); |
96 if (result.IsJust()) { | 67 if (result.IsJust()) { |
97 return isolate->heap()->ToBoolean(result.FromJust()); | 68 return isolate->heap()->ToBoolean(result.FromJust()); |
98 } else { | 69 } else { |
99 return isolate->heap()->exception(); | 70 return isolate->heap()->exception(); |
100 } | 71 } |
101 } | 72 } |
102 | 73 |
103 | 74 |
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) { | 75 RUNTIME_FUNCTION(Runtime_InterpreterToBoolean) { |
123 SealHandleScope shs(isolate); | 76 SealHandleScope shs(isolate); |
124 DCHECK_EQ(1, args.length()); | 77 DCHECK_EQ(1, args.length()); |
125 CONVERT_ARG_CHECKED(Object, x, 0); | 78 CONVERT_ARG_CHECKED(Object, x, 0); |
126 return isolate->heap()->ToBoolean(x->BooleanValue()); | 79 return isolate->heap()->ToBoolean(x->BooleanValue()); |
127 } | 80 } |
128 | 81 |
129 | 82 |
130 RUNTIME_FUNCTION(Runtime_InterpreterLogicalNot) { | 83 RUNTIME_FUNCTION(Runtime_InterpreterLogicalNot) { |
131 SealHandleScope shs(isolate); | 84 SealHandleScope shs(isolate); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { | 210 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { |
258 SealHandleScope shs(isolate); | 211 SealHandleScope shs(isolate); |
259 DCHECK_EQ(1, args.length()); | 212 DCHECK_EQ(1, args.length()); |
260 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0); | 213 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0); |
261 isolate->thread_local_top()->pending_message_obj_ = *message; | 214 isolate->thread_local_top()->pending_message_obj_ = *message; |
262 return isolate->heap()->undefined_value(); | 215 return isolate->heap()->undefined_value(); |
263 } | 216 } |
264 | 217 |
265 } // namespace internal | 218 } // namespace internal |
266 } // namespace v8 | 219 } // namespace v8 |
OLD | NEW |