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

Side by Side Diff: src/runtime.cc

Issue 542074: Fix crash when using Object.getOwnPropertyDescriptor on an API defined... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 CONVERT_CHECKED(JSObject, obj, args[0]); 590 CONVERT_CHECKED(JSObject, obj, args[0]);
591 CONVERT_CHECKED(String, name, args[1]); 591 CONVERT_CHECKED(String, name, args[1]);
592 592
593 // Use recursive implementation to also traverse hidden prototypes 593 // Use recursive implementation to also traverse hidden prototypes
594 GetOwnPropertyImplementation(obj, name, &result); 594 GetOwnPropertyImplementation(obj, name, &result);
595 595
596 if (!result.IsProperty()) 596 if (!result.IsProperty())
597 return Heap::undefined_value(); 597 return Heap::undefined_value();
598 598
599 if (result.type() == CALLBACKS) { 599 if (result.type() == CALLBACKS) {
600 elms->set(0, Heap::true_value());
601 Object* structure = result.GetCallbackObject(); 600 Object* structure = result.GetCallbackObject();
602 if (structure->IsProxy()) { 601 if (structure->IsProxy()) {
603 Object* value = obj->GetPropertyWithCallback( 602 // Property that is internally implemented as a callback.
604 obj, structure, name, result.holder()); 603 Object* value = obj->GetPropertyWithCallback(
605 elms->set(1, value); 604 obj, structure, name, result.holder());
606 elms->set(2, Heap::ToBoolean(!result.IsReadOnly())); 605 elms->set(0, Heap::false_value());
607 } else { 606 elms->set(1, value);
607 elms->set(2, Heap::ToBoolean(!result.IsReadOnly()));
608 } else if (structure->IsFixedArray()) {
609 // __defineGetter__/__defineSetter__ callback.
610 elms->set(0, Heap::true_value());
608 elms->set(1, FixedArray::cast(structure)->get(0)); 611 elms->set(1, FixedArray::cast(structure)->get(0));
609 elms->set(2, FixedArray::cast(structure)->get(1)); 612 elms->set(2, FixedArray::cast(structure)->get(1));
613 } else {
614 // TODO(ricow): Handle API callbacks.
615 return Heap::undefined_value();
610 } 616 }
611 } else { 617 } else {
612 elms->set(0, Heap::false_value()); 618 elms->set(0, Heap::false_value());
613 elms->set(1, result.GetLazyValue()); 619 elms->set(1, result.GetLazyValue());
614 elms->set(2, Heap::ToBoolean(!result.IsReadOnly())); 620 elms->set(2, Heap::ToBoolean(!result.IsReadOnly()));
615 } 621 }
616 622
617 elms->set(3, Heap::ToBoolean(!result.IsDontEnum())); 623 elms->set(3, Heap::ToBoolean(!result.IsDontEnum()));
618 elms->set(4, Heap::ToBoolean(!result.IsReadOnly())); 624 elms->set(4, Heap::ToBoolean(!result.IsReadOnly()));
619 return *desc; 625 return *desc;
(...skipping 7524 matching lines...) Expand 10 before | Expand all | Expand 10 after
8144 } else { 8150 } else {
8145 // Handle last resort GC and make sure to allow future allocations 8151 // Handle last resort GC and make sure to allow future allocations
8146 // to grow the heap without causing GCs (if possible). 8152 // to grow the heap without causing GCs (if possible).
8147 Counters::gc_last_resort_from_js.Increment(); 8153 Counters::gc_last_resort_from_js.Increment();
8148 Heap::CollectAllGarbage(false); 8154 Heap::CollectAllGarbage(false);
8149 } 8155 }
8150 } 8156 }
8151 8157
8152 8158
8153 } } // namespace v8::internal 8159 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698