Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: src/objects-printer.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: fix async tests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 break; 143 break;
144 144
145 case FILLER_TYPE: 145 case FILLER_TYPE:
146 os << "filler"; 146 os << "filler";
147 break; 147 break;
148 case JS_OBJECT_TYPE: // fall through 148 case JS_OBJECT_TYPE: // fall through
149 case JS_API_OBJECT_TYPE: 149 case JS_API_OBJECT_TYPE:
150 case JS_SPECIAL_API_OBJECT_TYPE: 150 case JS_SPECIAL_API_OBJECT_TYPE:
151 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 151 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
152 case JS_GENERATOR_OBJECT_TYPE: 152 case JS_GENERATOR_OBJECT_TYPE:
153 case JS_ASYNC_GENERATOR_OBJECT_TYPE:
153 case JS_ARGUMENTS_TYPE: 154 case JS_ARGUMENTS_TYPE:
154 case JS_ERROR_TYPE: 155 case JS_ERROR_TYPE:
155 case JS_PROMISE_CAPABILITY_TYPE: 156 case JS_PROMISE_CAPABILITY_TYPE:
156 JSObject::cast(this)->JSObjectPrint(os); 157 JSObject::cast(this)->JSObjectPrint(os);
157 break; 158 break;
158 case JS_PROMISE_TYPE: 159 case JS_PROMISE_TYPE:
159 JSPromise::cast(this)->JSPromisePrint(os); 160 JSPromise::cast(this)->JSPromisePrint(os);
160 break; 161 break;
161 case JS_ARRAY_TYPE: 162 case JS_ARRAY_TYPE:
162 JSArray::cast(this)->JSArrayPrint(os); 163 JSArray::cast(this)->JSArrayPrint(os);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 break; 233 break;
233 case JS_ARRAY_BUFFER_TYPE: 234 case JS_ARRAY_BUFFER_TYPE:
234 JSArrayBuffer::cast(this)->JSArrayBufferPrint(os); 235 JSArrayBuffer::cast(this)->JSArrayBufferPrint(os);
235 break; 236 break;
236 case JS_TYPED_ARRAY_TYPE: 237 case JS_TYPED_ARRAY_TYPE:
237 JSTypedArray::cast(this)->JSTypedArrayPrint(os); 238 JSTypedArray::cast(this)->JSTypedArrayPrint(os);
238 break; 239 break;
239 case JS_DATA_VIEW_TYPE: 240 case JS_DATA_VIEW_TYPE:
240 JSDataView::cast(this)->JSDataViewPrint(os); 241 JSDataView::cast(this)->JSDataViewPrint(os);
241 break; 242 break;
243 case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE:
244 JSAsyncFromSyncIterator::cast(this)->JSAsyncFromSyncIteratorPrint(os);
245 break;
242 #define MAKE_STRUCT_CASE(NAME, Name, name) \ 246 #define MAKE_STRUCT_CASE(NAME, Name, name) \
243 case NAME##_TYPE: \ 247 case NAME##_TYPE: \
244 Name::cast(this)->Name##Print(os); \ 248 Name::cast(this)->Name##Print(os); \
245 break; 249 break;
246 STRUCT_LIST(MAKE_STRUCT_CASE) 250 STRUCT_LIST(MAKE_STRUCT_CASE)
247 #undef MAKE_STRUCT_CASE 251 #undef MAKE_STRUCT_CASE
248 252
249 default: 253 default:
250 os << "UNKNOWN TYPE " << map()->instance_type(); 254 os << "UNKNOWN TYPE " << map()->instance_type();
251 UNREACHABLE(); 255 UNREACHABLE();
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 os << "\n - tasks: " << Brief(tasks()); 1261 os << "\n - tasks: " << Brief(tasks());
1258 os << "\n - deferred_promise: " << Brief(deferred_promise()); 1262 os << "\n - deferred_promise: " << Brief(deferred_promise());
1259 os << "\n - deferred_on_resolve: " << Brief(deferred_on_resolve()); 1263 os << "\n - deferred_on_resolve: " << Brief(deferred_on_resolve());
1260 os << "\n - deferred_on_reject: " << Brief(deferred_on_reject()); 1264 os << "\n - deferred_on_reject: " << Brief(deferred_on_reject());
1261 os << "\n - debug id: " << debug_id(); 1265 os << "\n - debug id: " << debug_id();
1262 os << "\n - debug name: " << debug_name(); 1266 os << "\n - debug name: " << debug_name();
1263 os << "\n - reaction context: " << Brief(context()); 1267 os << "\n - reaction context: " << Brief(context());
1264 os << "\n"; 1268 os << "\n";
1265 } 1269 }
1266 1270
1271 void AsyncGeneratorRequest::AsyncGeneratorRequestPrint(
1272 std::ostream& os) { // NOLINT
1273 HeapObject::PrintHeader(os, "AsyncGeneratorRequest");
1274 const char* mode = "Invalid!";
1275 switch (resume_mode()) {
1276 case JSGeneratorObject::kNext:
1277 mode = ".next()";
1278 break;
1279 case JSGeneratorObject::kReturn:
1280 mode = ".return()";
1281 break;
1282 case JSGeneratorObject::kThrow:
1283 mode = ".throw()";
1284 break;
1285 }
1286 os << "\n - resume mode: " << mode;
1287 os << "\n - value: " << Brief(value());
1288 os << "\n";
1289 }
1290
1267 void ModuleInfoEntry::ModuleInfoEntryPrint(std::ostream& os) { // NOLINT 1291 void ModuleInfoEntry::ModuleInfoEntryPrint(std::ostream& os) { // NOLINT
1268 HeapObject::PrintHeader(os, "ModuleInfoEntry"); 1292 HeapObject::PrintHeader(os, "ModuleInfoEntry");
1269 os << "\n - export_name: " << Brief(export_name()); 1293 os << "\n - export_name: " << Brief(export_name());
1270 os << "\n - local_name: " << Brief(local_name()); 1294 os << "\n - local_name: " << Brief(local_name());
1271 os << "\n - import_name: " << Brief(import_name()); 1295 os << "\n - import_name: " << Brief(import_name());
1272 os << "\n - module_request: " << module_request(); 1296 os << "\n - module_request: " << module_request();
1273 os << "\n - cell_index: " << cell_index(); 1297 os << "\n - cell_index: " << cell_index();
1274 os << "\n - beg_pos: " << beg_pos(); 1298 os << "\n - beg_pos: " << beg_pos();
1275 os << "\n - end_pos: " << end_pos(); 1299 os << "\n - end_pos: " << end_pos();
1276 os << "\n"; 1300 os << "\n";
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 os << "\n"; 1620 os << "\n";
1597 } 1621 }
1598 1622
1599 1623
1600 void TransitionArray::Print() { 1624 void TransitionArray::Print() {
1601 OFStream os(stdout); 1625 OFStream os(stdout);
1602 TransitionArray::PrintTransitions(os, this); 1626 TransitionArray::PrintTransitions(os, this);
1603 os << "\n" << std::flush; 1627 os << "\n" << std::flush;
1604 } 1628 }
1605 1629
1630 void JSAsyncFromSyncIterator::JSAsyncFromSyncIteratorPrint(
1631 std::ostream& os) { // NOLINT
1632 HeapObject::PrintHeader(os, "JSAsyncFromSyncIterator");
1633 std::stringstream ss;
1634 os << "\n sync_iterator: " << Brief(sync_iterator());
1635 os << "\n";
1636 }
1606 1637
1607 void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions, 1638 void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions,
1608 bool print_header) { // NOLINT 1639 bool print_header) { // NOLINT
1609 int num_transitions = NumberOfTransitions(transitions); 1640 int num_transitions = NumberOfTransitions(transitions);
1610 if (print_header) { 1641 if (print_header) {
1611 os << "Transition array #" << num_transitions << ":"; 1642 os << "Transition array #" << num_transitions << ":";
1612 } 1643 }
1613 for (int i = 0; i < num_transitions; i++) { 1644 for (int i = 0; i < num_transitions; i++) {
1614 Name* key = GetKey(transitions, i); 1645 Name* key = GetKey(transitions, i);
1615 Map* target = GetTarget(transitions, i); 1646 Map* target = GetTarget(transitions, i);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 printf("Not a transition array\n"); 1735 printf("Not a transition array\n");
1705 } else { 1736 } else {
1706 reinterpret_cast<i::TransitionArray*>(object)->Print(); 1737 reinterpret_cast<i::TransitionArray*>(object)->Print();
1707 } 1738 }
1708 } 1739 }
1709 1740
1710 extern void _v8_internal_Print_StackTrace() { 1741 extern void _v8_internal_Print_StackTrace() {
1711 i::Isolate* isolate = i::Isolate::Current(); 1742 i::Isolate* isolate = i::Isolate::Current();
1712 isolate->PrintStack(stdout); 1743 isolate->PrintStack(stdout);
1713 } 1744 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698