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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 factory->NewStringFromAsciiChecked("[[GeneratorStatus]]"); | 228 factory->NewStringFromAsciiChecked("[[GeneratorStatus]]"); |
229 result->set(0, *generator_status); | 229 result->set(0, *generator_status); |
230 Handle<String> status_str = factory->NewStringFromAsciiChecked(status); | 230 Handle<String> status_str = factory->NewStringFromAsciiChecked(status); |
231 result->set(1, *status_str); | 231 result->set(1, *status_str); |
232 | 232 |
233 Handle<String> function = | 233 Handle<String> function = |
234 factory->NewStringFromAsciiChecked("[[GeneratorFunction]]"); | 234 factory->NewStringFromAsciiChecked("[[GeneratorFunction]]"); |
235 result->set(2, *function); | 235 result->set(2, *function); |
236 result->set(3, generator->function()); | 236 result->set(3, generator->function()); |
237 | 237 |
238 Handle<String> receiver = | |
239 factory->NewStringFromAsciiChecked("[[GeneratorReceiver]]"); | |
240 result->set(4, *receiver); | |
241 result->set(5, generator->receiver()); | |
242 return factory->NewJSArrayWithElements(result); | 238 return factory->NewJSArrayWithElements(result); |
243 } else if (Object::IsPromise(object)) { | 239 } else if (Object::IsPromise(object)) { |
244 Handle<JSObject> promise = Handle<JSObject>::cast(object); | 240 Handle<JSObject> promise = Handle<JSObject>::cast(object); |
245 | 241 |
246 Handle<Object> status_obj = | 242 Handle<Object> status_obj = |
247 DebugGetProperty(promise, isolate->factory()->promise_state_symbol()); | 243 DebugGetProperty(promise, isolate->factory()->promise_state_symbol()); |
248 RUNTIME_ASSERT_HANDLIFIED(status_obj->IsSmi(), JSArray); | 244 RUNTIME_ASSERT_HANDLIFIED(status_obj->IsSmi(), JSArray); |
249 const char* status = "rejected"; | 245 const char* status = "rejected"; |
250 int status_val = Handle<Smi>::cast(status_obj)->value(); | 246 int status_val = Handle<Smi>::cast(status_obj)->value(); |
251 switch (status_val) { | 247 switch (status_val) { |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 } | 684 } |
689 | 685 |
690 // Add the value being returned. | 686 // Add the value being returned. |
691 if (at_return) { | 687 if (at_return) { |
692 details->set(details_index++, *return_value); | 688 details->set(details_index++, *return_value); |
693 } | 689 } |
694 | 690 |
695 // Add the receiver (same as in function frame). | 691 // Add the receiver (same as in function frame). |
696 Handle<Object> receiver(it.frame()->receiver(), isolate); | 692 Handle<Object> receiver(it.frame()->receiver(), isolate); |
697 DCHECK(!function->shared()->IsBuiltin()); | 693 DCHECK(!function->shared()->IsBuiltin()); |
698 DCHECK_IMPLIES(is_sloppy(shared->language_mode()), receiver->IsJSReceiver()); | 694 DCHECK_IMPLIES( |
| 695 is_sloppy(shared->language_mode()), |
| 696 receiver->IsJSReceiver() || |
| 697 // If this frame is a resumed generator, the receiver may be the hole, |
| 698 // but |
| 699 // it will not be observed as such due to forced context allocation. |
| 700 (*receiver == isolate->heap()->the_hole_value() && |
| 701 function->shared()->is_generator())); |
699 details->set(kFrameDetailsReceiverIndex, *receiver); | 702 details->set(kFrameDetailsReceiverIndex, *receiver); |
700 | 703 |
701 DCHECK_EQ(details_size, details_index); | 704 DCHECK_EQ(details_size, details_index); |
702 return *isolate->factory()->NewJSArrayWithElements(details); | 705 return *isolate->factory()->NewJSArrayWithElements(details); |
703 } | 706 } |
704 | 707 |
705 | 708 |
706 RUNTIME_FUNCTION(Runtime_GetScopeCount) { | 709 RUNTIME_FUNCTION(Runtime_GetScopeCount) { |
707 HandleScope scope(isolate); | 710 HandleScope scope(isolate); |
708 DCHECK(args.length() == 2); | 711 DCHECK(args.length() == 2); |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 return Smi::FromInt(isolate->debug()->is_active()); | 1548 return Smi::FromInt(isolate->debug()->is_active()); |
1546 } | 1549 } |
1547 | 1550 |
1548 | 1551 |
1549 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1552 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
1550 UNIMPLEMENTED(); | 1553 UNIMPLEMENTED(); |
1551 return NULL; | 1554 return NULL; |
1552 } | 1555 } |
1553 } // namespace internal | 1556 } // namespace internal |
1554 } // namespace v8 | 1557 } // namespace v8 |
OLD | NEW |