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

Side by Side Diff: src/deoptimizer.cc

Issue 22327008: Fix handle unsafety in Deoptimizer::MaterializeNextHeapObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 // Construct an arguments object and copy the parameters to a newly 1668 // Construct an arguments object and copy the parameters to a newly
1669 // allocated arguments object backing store. 1669 // allocated arguments object backing store.
1670 Handle<JSFunction> function = ArgumentsObjectFunction(object_index); 1670 Handle<JSFunction> function = ArgumentsObjectFunction(object_index);
1671 Handle<JSObject> arguments = 1671 Handle<JSObject> arguments =
1672 isolate_->factory()->NewArgumentsObject(function, length); 1672 isolate_->factory()->NewArgumentsObject(function, length);
1673 Handle<FixedArray> array = isolate_->factory()->NewFixedArray(length); 1673 Handle<FixedArray> array = isolate_->factory()->NewFixedArray(length);
1674 ASSERT(array->length() == length); 1674 ASSERT(array->length() == length);
1675 arguments->set_elements(*array); 1675 arguments->set_elements(*array);
1676 materialized_objects_->Add(arguments); 1676 materialized_objects_->Add(arguments);
1677 for (int i = 0; i < length; ++i) { 1677 for (int i = 0; i < length; ++i) {
1678 array->set(i, *MaterializeNextValue()); 1678 Handle<Object> value = MaterializeNextValue();
1679 array->set(i, *value);
1679 } 1680 }
1680 } else { 1681 } else {
1681 // Dispatch on the instance type of the object to be materialized. 1682 // Dispatch on the instance type of the object to be materialized.
1682 Handle<Map> map = Handle<Map>::cast(MaterializeNextValue()); 1683 Handle<Map> map = Handle<Map>::cast(MaterializeNextValue());
1683 switch (map->instance_type()) { 1684 switch (map->instance_type()) {
1684 case HEAP_NUMBER_TYPE: { 1685 case HEAP_NUMBER_TYPE: {
1685 Handle<HeapNumber> number = 1686 Handle<HeapNumber> number =
1686 Handle<HeapNumber>::cast(MaterializeNextValue()); 1687 Handle<HeapNumber>::cast(MaterializeNextValue());
1687 materialized_objects_->Add(number); 1688 materialized_objects_->Add(number);
1688 materialization_value_index_ += kDoubleSize / kPointerSize - 1; 1689 materialization_value_index_ += kDoubleSize / kPointerSize - 1;
1689 break; 1690 break;
1690 } 1691 }
1691 case JS_OBJECT_TYPE: { 1692 case JS_OBJECT_TYPE: {
1692 Handle<JSObject> object = 1693 Handle<JSObject> object =
1693 isolate_->factory()->NewJSObjectFromMap(map, NOT_TENURED, false); 1694 isolate_->factory()->NewJSObjectFromMap(map, NOT_TENURED, false);
1694 materialized_objects_->Add(object); 1695 materialized_objects_->Add(object);
1695 object->set_properties(FixedArray::cast(*MaterializeNextValue())); 1696 Handle<Object> properties = MaterializeNextValue();
1696 object->set_elements(FixedArray::cast(*MaterializeNextValue())); 1697 Handle<Object> elements = MaterializeNextValue();
1698 object->set_properties(FixedArray::cast(*properties));
1699 object->set_elements(FixedArray::cast(*elements));
1697 for (int i = 0; i < length - 3; ++i) { 1700 for (int i = 0; i < length - 3; ++i) {
1698 object->FastPropertyAtPut(i, *MaterializeNextValue()); 1701 Handle<Object> value = MaterializeNextValue();
1702 object->FastPropertyAtPut(i, *value);
1699 } 1703 }
1700 break; 1704 break;
1701 } 1705 }
1702 default: 1706 default:
1703 PrintF("[couldn't handle instance type %d]\n", map->instance_type()); 1707 PrintF("[couldn't handle instance type %d]\n", map->instance_type());
1704 UNREACHABLE(); 1708 UNREACHABLE();
1705 } 1709 }
1706 } 1710 }
1707 1711
1708 return materialized_objects_->at(object_index); 1712 return materialized_objects_->at(object_index);
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 3309
3306 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3310 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3307 v->VisitPointer(BitCast<Object**>(&function_)); 3311 v->VisitPointer(BitCast<Object**>(&function_));
3308 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3312 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3309 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3313 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3310 } 3314 }
3311 3315
3312 #endif // ENABLE_DEBUGGER_SUPPORT 3316 #endif // ENABLE_DEBUGGER_SUPPORT
3313 3317
3314 } } // namespace v8::internal 3318 } } // 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