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

Side by Side Diff: src/elements.cc

Issue 12254007: Make the Isolate parameter mandatory for internal HandleScopes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 years, 10 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/debug.cc ('k') | src/frames.h » ('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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 int entry = from->FindEntry(i + from_start); 476 int entry = from->FindEntry(i + from_start);
477 if (entry != SeededNumberDictionary::kNotFound) { 477 if (entry != SeededNumberDictionary::kNotFound) {
478 to->set(i + to_start, from->ValueAt(entry)->Number()); 478 to->set(i + to_start, from->ValueAt(entry)->Number());
479 } else { 479 } else {
480 to->set_the_hole(i + to_start); 480 to->set_the_hole(i + to_start);
481 } 481 }
482 } 482 }
483 } 483 }
484 484
485 485
486 static void TraceTopFrame() { 486 static void TraceTopFrame(Isolate* isolate) {
487 StackFrameIterator it; 487 StackFrameIterator it(isolate);
488 if (it.done()) { 488 if (it.done()) {
489 PrintF("unknown location (no JavaScript frames present)"); 489 PrintF("unknown location (no JavaScript frames present)");
490 return; 490 return;
491 } 491 }
492 StackFrame* raw_frame = it.frame(); 492 StackFrame* raw_frame = it.frame();
493 if (raw_frame->is_internal()) { 493 if (raw_frame->is_internal()) {
494 Isolate* isolate = Isolate::Current(); 494 Isolate* isolate = Isolate::Current();
495 Code* apply_builtin = isolate->builtins()->builtin( 495 Code* apply_builtin = isolate->builtins()->builtin(
496 Builtins::kFunctionApply); 496 Builtins::kFunctionApply);
497 if (raw_frame->unchecked_code() == apply_builtin) { 497 if (raw_frame->unchecked_code() == apply_builtin) {
498 PrintF("apply from "); 498 PrintF("apply from ");
499 it.Advance(); 499 it.Advance();
500 raw_frame = it.frame(); 500 raw_frame = it.frame();
501 } 501 }
502 } 502 }
503 JavaScriptFrame::PrintTop(stdout, false, true); 503 JavaScriptFrame::PrintTop(isolate, stdout, false, true);
504 } 504 }
505 505
506 506
507 void CheckArrayAbuse(JSObject* obj, const char* op, uint32_t key, 507 void CheckArrayAbuse(JSObject* obj, const char* op, uint32_t key,
508 bool allow_appending) { 508 bool allow_appending) {
509 Object* raw_length = NULL; 509 Object* raw_length = NULL;
510 const char* elements_type = "array"; 510 const char* elements_type = "array";
511 if (obj->IsJSArray()) { 511 if (obj->IsJSArray()) {
512 JSArray* array = JSArray::cast(obj); 512 JSArray* array = JSArray::cast(obj);
513 raw_length = array->length(); 513 raw_length = array->length();
514 } else { 514 } else {
515 raw_length = Smi::FromInt(obj->elements()->length()); 515 raw_length = Smi::FromInt(obj->elements()->length());
516 elements_type = "object"; 516 elements_type = "object";
517 } 517 }
518 518
519 if (raw_length->IsNumber()) { 519 if (raw_length->IsNumber()) {
520 double n = raw_length->Number(); 520 double n = raw_length->Number();
521 if (FastI2D(FastD2UI(n)) == n) { 521 if (FastI2D(FastD2UI(n)) == n) {
522 int32_t int32_length = DoubleToInt32(n); 522 int32_t int32_length = DoubleToInt32(n);
523 uint32_t compare_length = static_cast<uint32_t>(int32_length); 523 uint32_t compare_length = static_cast<uint32_t>(int32_length);
524 if (allow_appending) compare_length++; 524 if (allow_appending) compare_length++;
525 if (key >= compare_length) { 525 if (key >= compare_length) {
526 PrintF("[OOB %s %s (%s length = %d, element accessed = %d) in ", 526 PrintF("[OOB %s %s (%s length = %d, element accessed = %d) in ",
527 elements_type, op, elements_type, 527 elements_type, op, elements_type,
528 static_cast<int>(int32_length), 528 static_cast<int>(int32_length),
529 static_cast<int>(key)); 529 static_cast<int>(key));
530 TraceTopFrame(); 530 TraceTopFrame(obj->GetIsolate());
531 PrintF("]\n"); 531 PrintF("]\n");
532 } 532 }
533 } else { 533 } else {
534 PrintF("[%s elements length not integer value in ", elements_type); 534 PrintF("[%s elements length not integer value in ", elements_type);
535 TraceTopFrame(); 535 TraceTopFrame(obj->GetIsolate());
536 PrintF("]\n"); 536 PrintF("]\n");
537 } 537 }
538 } else { 538 } else {
539 PrintF("[%s elements length not a number in ", elements_type); 539 PrintF("[%s elements length not a number in ", elements_type);
540 TraceTopFrame(); 540 TraceTopFrame(obj->GetIsolate());
541 PrintF("]\n"); 541 PrintF("]\n");
542 } 542 }
543 } 543 }
544 544
545 545
546 // Base class for element handler implementations. Contains the 546 // Base class for element handler implementations. Contains the
547 // the common logic for objects with different ElementsKinds. 547 // the common logic for objects with different ElementsKinds.
548 // Subclasses must specialize method for which the element 548 // Subclasses must specialize method for which the element
549 // implementation differs from the base class implementation. 549 // implementation differs from the base class implementation.
550 // 550 //
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; 1967 if (!maybe_obj->To(&new_backing_store)) return maybe_obj;
1968 new_backing_store->set(0, length); 1968 new_backing_store->set(0, length);
1969 { MaybeObject* result = array->SetContent(new_backing_store); 1969 { MaybeObject* result = array->SetContent(new_backing_store);
1970 if (result->IsFailure()) return result; 1970 if (result->IsFailure()) return result;
1971 } 1971 }
1972 return array; 1972 return array;
1973 } 1973 }
1974 1974
1975 1975
1976 } } // namespace v8::internal 1976 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698