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

Side by Side Diff: src/string-stream.cc

Issue 23468021: move HEAP to /test (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/store-buffer-inl.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 Add("/* anonymous */"); 343 Add("/* anonymous */");
344 } 344 }
345 } else { 345 } else {
346 Add("%o", name); 346 Add("%o", name);
347 } 347 }
348 } 348 }
349 349
350 350
351 void StringStream::PrintUsingMap(JSObject* js_object) { 351 void StringStream::PrintUsingMap(JSObject* js_object) {
352 Map* map = js_object->map(); 352 Map* map = js_object->map();
353 if (!HEAP->Contains(map) || 353 if (!js_object->GetHeap()->Contains(map) ||
354 !map->IsHeapObject() || 354 !map->IsHeapObject() ||
355 !map->IsMap()) { 355 !map->IsMap()) {
356 Add("<Invalid map>\n"); 356 Add("<Invalid map>\n");
357 return; 357 return;
358 } 358 }
359 int real_size = map->NumberOfOwnDescriptors(); 359 int real_size = map->NumberOfOwnDescriptors();
360 DescriptorArray* descs = map->instance_descriptors(); 360 DescriptorArray* descs = map->instance_descriptors();
361 for (int i = 0; i < real_size; i++) { 361 for (int i = 0; i < real_size; i++) {
362 PropertyDetails details = descs->GetDetails(i); 362 PropertyDetails details = descs->GetDetails(i);
363 if (details.type() == FIELD) { 363 if (details.type() == FIELD) {
(...skipping 13 matching lines...) Expand all
377 Add(": "); 377 Add(": ");
378 Object* value = js_object->RawFastPropertyAt(descs->GetFieldIndex(i)); 378 Object* value = js_object->RawFastPropertyAt(descs->GetFieldIndex(i));
379 Add("%o\n", value); 379 Add("%o\n", value);
380 } 380 }
381 } 381 }
382 } 382 }
383 } 383 }
384 384
385 385
386 void StringStream::PrintFixedArray(FixedArray* array, unsigned int limit) { 386 void StringStream::PrintFixedArray(FixedArray* array, unsigned int limit) {
387 Heap* heap = HEAP; 387 Heap* heap = array->GetHeap();
388 for (unsigned int i = 0; i < 10 && i < limit; i++) { 388 for (unsigned int i = 0; i < 10 && i < limit; i++) {
389 Object* element = array->get(i); 389 Object* element = array->get(i);
390 if (element != heap->the_hole_value()) { 390 if (element != heap->the_hole_value()) {
391 for (int len = 1; len < 18; len++) 391 for (int len = 1; len < 18; len++)
392 Put(' '); 392 Put(' ');
393 Add("%d: %o\n", i, array->get(i)); 393 Add("%d: %o\n", i, array->get(i));
394 } 394 }
395 } 395 }
396 if (limit >= 10) { 396 if (limit >= 10) {
397 Add(" ...\n"); 397 Add(" ...\n");
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 Add("Security context: %o\n", token); 484 Add("Security context: %o\n", token);
485 isolate->set_string_stream_current_security_token(token); 485 isolate->set_string_stream_current_security_token(token);
486 } 486 }
487 } else { 487 } else {
488 Add("(Function context is corrupt)\n"); 488 Add("(Function context is corrupt)\n");
489 } 489 }
490 } 490 }
491 491
492 492
493 void StringStream::PrintFunction(Object* f, Object* receiver, Code** code) { 493 void StringStream::PrintFunction(Object* f, Object* receiver, Code** code) {
494 if (f->IsHeapObject() && 494 if (!f->IsHeapObject()) {
495 HEAP->Contains(HeapObject::cast(f)) && 495 Add("/* warning: 'function' was not a heap object */ ");
496 HEAP->Contains(HeapObject::cast(f)->map()) && 496 return;
497 HeapObject::cast(f)->map()->IsMap()) { 497 }
498 if (f->IsJSFunction()) { 498 Heap* heap = HeapObject::cast(f)->GetHeap();
499 JSFunction* fun = JSFunction::cast(f); 499 if (!heap->Contains(HeapObject::cast(f))) {
500 // Common case: on-stack function present and resolved. 500 Add("/* warning: 'function' was not on the heap */ ");
501 PrintPrototype(fun, receiver); 501 return;
502 *code = fun->code(); 502 }
503 } else if (f->IsInternalizedString()) { 503 if (!heap->Contains(HeapObject::cast(f)->map())) {
504 // Unresolved and megamorphic calls: Instead of the function 504 Add("/* warning: function's map was not on the heap */ ");
505 // we have the function name on the stack. 505 return;
506 PrintName(f); 506 }
507 Add("/* unresolved */ "); 507 if (!HeapObject::cast(f)->map()->IsMap()) {
508 } else { 508 Add("/* warning: function's map was not a valid map */ ");
509 // Unless this is the frame of a built-in function, we should always have 509 return;
510 // the callee function or name on the stack. If we don't, we have a 510 }
511 // problem or a change of the stack frame layout. 511 if (f->IsJSFunction()) {
512 Add("%o", f); 512 JSFunction* fun = JSFunction::cast(f);
513 Add("/* warning: no JSFunction object or function name found */ "); 513 // Common case: on-stack function present and resolved.
514 } 514 PrintPrototype(fun, receiver);
515 /* } else if (is_trampoline()) { 515 *code = fun->code();
516 Print("trampoline "); 516 } else if (f->IsInternalizedString()) {
517 */ 517 // Unresolved and megamorphic calls: Instead of the function
518 // we have the function name on the stack.
519 PrintName(f);
520 Add("/* unresolved */ ");
518 } else { 521 } else {
519 if (!f->IsHeapObject()) { 522 // Unless this is the frame of a built-in function, we should always have
520 Add("/* warning: 'function' was not a heap object */ "); 523 // the callee function or name on the stack. If we don't, we have a
521 return; 524 // problem or a change of the stack frame layout.
522 } 525 Add("%o", f);
523 if (!HEAP->Contains(HeapObject::cast(f))) { 526 Add("/* warning: no JSFunction object or function name found */ ");
524 Add("/* warning: 'function' was not on the heap */ ");
525 return;
526 }
527 if (!HEAP->Contains(HeapObject::cast(f)->map())) {
528 Add("/* warning: function's map was not on the heap */ ");
529 return;
530 }
531 if (!HeapObject::cast(f)->map()->IsMap()) {
532 Add("/* warning: function's map was not a valid map */ ");
533 return;
534 }
535 Add("/* warning: Invalid JSFunction object found */ ");
536 } 527 }
537 } 528 }
538 529
539 530
540 void StringStream::PrintPrototype(JSFunction* fun, Object* receiver) { 531 void StringStream::PrintPrototype(JSFunction* fun, Object* receiver) {
541 Object* name = fun->shared()->name(); 532 Object* name = fun->shared()->name();
542 bool print_name = false; 533 bool print_name = false;
543 Isolate* isolate = fun->GetIsolate(); 534 Isolate* isolate = fun->GetIsolate();
544 for (Object* p = receiver; 535 for (Object* p = receiver;
545 p != isolate->heap()->null_value(); 536 p != isolate->heap()->null_value();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 583
593 // Only grow once to the maximum allowable size. 584 // Only grow once to the maximum allowable size.
594 char* NoAllocationStringAllocator::grow(unsigned* bytes) { 585 char* NoAllocationStringAllocator::grow(unsigned* bytes) {
595 ASSERT(size_ >= *bytes); 586 ASSERT(size_ >= *bytes);
596 *bytes = size_; 587 *bytes = size_;
597 return space_; 588 return space_;
598 } 589 }
599 590
600 591
601 } } // namespace v8::internal 592 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/store-buffer-inl.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698