OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/debug/debug-evaluate.h" | 8 #include "src/debug/debug-evaluate.h" |
9 #include "src/debug/debug-frames.h" | 9 #include "src/debug/debug-frames.h" |
10 #include "src/debug/debug-scopes.h" | 10 #include "src/debug/debug-scopes.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 LookupIterator it(object, name); | 138 LookupIterator it(object, name); |
139 return DebugGetProperty(&it); | 139 return DebugGetProperty(&it); |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 template <class IteratorType> | 143 template <class IteratorType> |
144 static MaybeHandle<JSArray> GetIteratorInternalProperties( | 144 static MaybeHandle<JSArray> GetIteratorInternalProperties( |
145 Isolate* isolate, Handle<IteratorType> object) { | 145 Isolate* isolate, Handle<IteratorType> object) { |
146 Factory* factory = isolate->factory(); | 146 Factory* factory = isolate->factory(); |
147 Handle<IteratorType> iterator = Handle<IteratorType>::cast(object); | 147 Handle<IteratorType> iterator = Handle<IteratorType>::cast(object); |
148 RUNTIME_ASSERT_HANDLIFIED(iterator->kind()->IsSmi(), JSArray); | 148 CHECK(iterator->kind()->IsSmi()); |
149 const char* kind = NULL; | 149 const char* kind = NULL; |
150 switch (Smi::cast(iterator->kind())->value()) { | 150 switch (Smi::cast(iterator->kind())->value()) { |
151 case IteratorType::kKindKeys: | 151 case IteratorType::kKindKeys: |
152 kind = "keys"; | 152 kind = "keys"; |
153 break; | 153 break; |
154 case IteratorType::kKindValues: | 154 case IteratorType::kKindValues: |
155 kind = "values"; | 155 kind = "values"; |
156 break; | 156 break; |
157 case IteratorType::kKindEntries: | 157 case IteratorType::kKindEntries: |
158 kind = "entries"; | 158 kind = "entries"; |
159 break; | 159 break; |
160 default: | 160 default: |
161 RUNTIME_ASSERT_HANDLIFIED(false, JSArray); | 161 UNREACHABLE(); |
162 } | 162 } |
163 | 163 |
164 Handle<FixedArray> result = factory->NewFixedArray(2 * 3); | 164 Handle<FixedArray> result = factory->NewFixedArray(2 * 3); |
165 Handle<String> has_more = | 165 Handle<String> has_more = |
166 factory->NewStringFromAsciiChecked("[[IteratorHasMore]]"); | 166 factory->NewStringFromAsciiChecked("[[IteratorHasMore]]"); |
167 result->set(0, *has_more); | 167 result->set(0, *has_more); |
168 result->set(1, isolate->heap()->ToBoolean(iterator->HasMore())); | 168 result->set(1, isolate->heap()->ToBoolean(iterator->HasMore())); |
169 | 169 |
170 Handle<String> index = | 170 Handle<String> index = |
171 factory->NewStringFromAsciiChecked("[[IteratorIndex]]"); | 171 factory->NewStringFromAsciiChecked("[[IteratorIndex]]"); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 Handle<String> receiver = | 241 Handle<String> receiver = |
242 factory->NewStringFromAsciiChecked("[[GeneratorReceiver]]"); | 242 factory->NewStringFromAsciiChecked("[[GeneratorReceiver]]"); |
243 result->set(4, *receiver); | 243 result->set(4, *receiver); |
244 result->set(5, generator->receiver()); | 244 result->set(5, generator->receiver()); |
245 return factory->NewJSArrayWithElements(result); | 245 return factory->NewJSArrayWithElements(result); |
246 } else if (Object::IsPromise(object)) { | 246 } else if (Object::IsPromise(object)) { |
247 Handle<JSObject> promise = Handle<JSObject>::cast(object); | 247 Handle<JSObject> promise = Handle<JSObject>::cast(object); |
248 | 248 |
249 Handle<Object> status_obj = | 249 Handle<Object> status_obj = |
250 DebugGetProperty(promise, isolate->factory()->promise_state_symbol()); | 250 DebugGetProperty(promise, isolate->factory()->promise_state_symbol()); |
251 RUNTIME_ASSERT_HANDLIFIED(status_obj->IsSmi(), JSArray); | 251 CHECK(status_obj->IsSmi()); |
252 const char* status = "rejected"; | 252 const char* status = "rejected"; |
253 int status_val = Handle<Smi>::cast(status_obj)->value(); | 253 int status_val = Handle<Smi>::cast(status_obj)->value(); |
254 switch (status_val) { | 254 switch (status_val) { |
255 case +1: | 255 case +1: |
256 status = "resolved"; | 256 status = "resolved"; |
257 break; | 257 break; |
258 case 0: | 258 case 0: |
259 status = "pending"; | 259 status = "pending"; |
260 break; | 260 break; |
261 default: | 261 default: |
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 return Smi::FromInt(isolate->debug()->is_active()); | 1733 return Smi::FromInt(isolate->debug()->is_active()); |
1734 } | 1734 } |
1735 | 1735 |
1736 | 1736 |
1737 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1737 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
1738 UNIMPLEMENTED(); | 1738 UNIMPLEMENTED(); |
1739 return NULL; | 1739 return NULL; |
1740 } | 1740 } |
1741 } // namespace internal | 1741 } // namespace internal |
1742 } // namespace v8 | 1742 } // namespace v8 |
OLD | NEW |