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 RUNTIME_FUNCTION(Runtime_InterpreterLessThan) { | |
20 HandleScope scope(isolate); | |
21 DCHECK_EQ(2, args.length()); | |
22 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
23 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
24 Maybe<bool> result = Object::LessThan(x, y); | |
25 if (result.IsJust()) { | |
26 return isolate->heap()->ToBoolean(result.FromJust()); | |
27 } else { | |
28 return isolate->heap()->exception(); | |
29 } | |
30 } | |
31 | |
32 | |
33 RUNTIME_FUNCTION(Runtime_InterpreterGreaterThan) { | |
34 HandleScope scope(isolate); | |
35 DCHECK_EQ(2, args.length()); | |
36 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
37 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
38 Maybe<bool> result = Object::GreaterThan(x, y); | |
39 if (result.IsJust()) { | |
40 return isolate->heap()->ToBoolean(result.FromJust()); | |
41 } else { | |
42 return isolate->heap()->exception(); | |
43 } | |
44 } | |
45 | |
46 | |
47 RUNTIME_FUNCTION(Runtime_InterpreterLessThanOrEqual) { | |
48 HandleScope scope(isolate); | |
49 DCHECK_EQ(2, args.length()); | |
50 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
51 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
52 Maybe<bool> result = Object::LessThanOrEqual(x, y); | |
53 if (result.IsJust()) { | |
54 return isolate->heap()->ToBoolean(result.FromJust()); | |
55 } else { | |
56 return isolate->heap()->exception(); | |
57 } | |
58 } | |
59 | |
60 | |
61 RUNTIME_FUNCTION(Runtime_InterpreterGreaterThanOrEqual) { | |
62 HandleScope scope(isolate); | |
63 DCHECK_EQ(2, args.length()); | |
64 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
65 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
66 Maybe<bool> result = Object::GreaterThanOrEqual(x, y); | |
67 if (result.IsJust()) { | |
68 return isolate->heap()->ToBoolean(result.FromJust()); | |
69 } else { | |
70 return isolate->heap()->exception(); | |
71 } | |
72 } | |
73 | |
74 | |
75 RUNTIME_FUNCTION(Runtime_InterpreterToBoolean) { | 19 RUNTIME_FUNCTION(Runtime_InterpreterToBoolean) { |
76 SealHandleScope shs(isolate); | 20 SealHandleScope shs(isolate); |
77 DCHECK_EQ(1, args.length()); | 21 DCHECK_EQ(1, args.length()); |
78 CONVERT_ARG_CHECKED(Object, x, 0); | 22 CONVERT_ARG_CHECKED(Object, x, 0); |
79 return isolate->heap()->ToBoolean(x->BooleanValue()); | 23 return isolate->heap()->ToBoolean(x->BooleanValue()); |
80 } | 24 } |
81 | 25 |
82 | 26 |
83 RUNTIME_FUNCTION(Runtime_InterpreterLogicalNot) { | 27 RUNTIME_FUNCTION(Runtime_InterpreterLogicalNot) { |
84 SealHandleScope shs(isolate); | 28 SealHandleScope shs(isolate); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { | 154 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { |
211 SealHandleScope shs(isolate); | 155 SealHandleScope shs(isolate); |
212 DCHECK_EQ(1, args.length()); | 156 DCHECK_EQ(1, args.length()); |
213 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0); | 157 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0); |
214 isolate->thread_local_top()->pending_message_obj_ = *message; | 158 isolate->thread_local_top()->pending_message_obj_ = *message; |
215 return isolate->heap()->undefined_value(); | 159 return isolate->heap()->undefined_value(); |
216 } | 160 } |
217 | 161 |
218 } // namespace internal | 162 } // namespace internal |
219 } // namespace v8 | 163 } // namespace v8 |
OLD | NEW |