Chromium Code Reviews| 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 "string-stream.h" | 5 #include "string-stream.h" |
| 6 | 6 |
| 7 #include "handles-inl.h" | 7 #include "handles-inl.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 // Unless this is the frame of a built-in function, we should always have | 495 // Unless this is the frame of a built-in function, we should always have |
| 496 // the callee function or name on the stack. If we don't, we have a | 496 // the callee function or name on the stack. If we don't, we have a |
| 497 // problem or a change of the stack frame layout. | 497 // problem or a change of the stack frame layout. |
| 498 Add("%o", f); | 498 Add("%o", f); |
| 499 Add("/* warning: no JSFunction object or function name found */ "); | 499 Add("/* warning: no JSFunction object or function name found */ "); |
| 500 } | 500 } |
| 501 } | 501 } |
| 502 | 502 |
| 503 | 503 |
| 504 void StringStream::PrintPrototype(JSFunction* fun, Object* receiver) { | 504 void StringStream::PrintPrototype(JSFunction* fun, Object* receiver) { |
| 505 Isolate* isolate = fun->GetIsolate(); | |
| 506 DisallowHeapAllocation no_alloc; | |
| 507 HandleScope scope(isolate); | |
| 508 | |
| 505 Object* name = fun->shared()->name(); | 509 Object* name = fun->shared()->name(); |
| 506 bool print_name = false; | 510 bool print_name = false; |
| 507 Isolate* isolate = fun->GetIsolate(); | 511 for (Handle<Object> p(receiver, isolate); |
| 508 for (Object* p = receiver; | 512 !p->IsNull(); |
| 509 p != isolate->heap()->null_value(); | 513 p = Object::GetPrototype(isolate, p)) { |
|
Yang
2014/04/15 13:10:48
Please don't handlify here.
| |
| 510 p = p->GetPrototype(isolate)) { | |
| 511 if (p->IsJSObject()) { | 514 if (p->IsJSObject()) { |
| 512 Object* key = JSObject::cast(p)->SlowReverseLookup(fun); | 515 Object* key = JSObject::cast(*p)->SlowReverseLookup(fun); |
| 513 if (key != isolate->heap()->undefined_value()) { | 516 if (key != isolate->heap()->undefined_value()) { |
| 514 if (!name->IsString() || | 517 if (!name->IsString() || |
| 515 !key->IsString() || | 518 !key->IsString() || |
| 516 !String::cast(name)->Equals(String::cast(key))) { | 519 !String::cast(name)->Equals(String::cast(key))) { |
| 517 print_name = true; | 520 print_name = true; |
| 518 } | 521 } |
| 519 if (name->IsString() && String::cast(name)->length() == 0) { | 522 if (name->IsString() && String::cast(name)->length() == 0) { |
| 520 print_name = false; | 523 print_name = false; |
| 521 } | 524 } |
| 522 name = key; | 525 name = key; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 | 559 |
| 557 // Only grow once to the maximum allowable size. | 560 // Only grow once to the maximum allowable size. |
| 558 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 561 char* NoAllocationStringAllocator::grow(unsigned* bytes) { |
| 559 ASSERT(size_ >= *bytes); | 562 ASSERT(size_ >= *bytes); |
| 560 *bytes = size_; | 563 *bytes = size_; |
| 561 return space_; | 564 return space_; |
| 562 } | 565 } |
| 563 | 566 |
| 564 | 567 |
| 565 } } // namespace v8::internal | 568 } } // namespace v8::internal |
| OLD | NEW |