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

Side by Side Diff: src/objects.cc

Issue 24201002: Open new handle scope when deep copying. (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 | « 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 5605 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 5616
5617 Handle<JSObject> JSObject::Copy(Handle<JSObject> object) { 5617 Handle<JSObject> JSObject::Copy(Handle<JSObject> object) {
5618 Isolate* isolate = object->GetIsolate(); 5618 Isolate* isolate = object->GetIsolate();
5619 CALL_HEAP_FUNCTION(isolate, 5619 CALL_HEAP_FUNCTION(isolate,
5620 isolate->heap()->CopyJSObject(*object), JSObject); 5620 isolate->heap()->CopyJSObject(*object), JSObject);
5621 } 5621 }
5622 5622
5623 5623
5624 Handle<JSObject> JSObject::DeepCopy(Handle<JSObject> object) { 5624 Handle<JSObject> JSObject::DeepCopy(Handle<JSObject> object) {
5625 Isolate* isolate = object->GetIsolate(); 5625 Isolate* isolate = object->GetIsolate();
5626 HandleScope handle_scope(isolate);
Michael Starzinger 2013/09/17 12:21:01 nit: You could move the handle scope down to right
Yang 2013/09/17 12:28:19 Done.
5626 StackLimitCheck check(isolate); 5627 StackLimitCheck check(isolate);
5627 if (check.HasOverflowed()) { 5628 if (check.HasOverflowed()) {
5628 isolate->StackOverflow(); 5629 isolate->StackOverflow();
5629 return Handle<JSObject>::null(); 5630 return Handle<JSObject>::null();
5630 } 5631 }
5631 5632
5632 if (object->map()->is_deprecated()) { 5633 if (object->map()->is_deprecated()) {
5633 MigrateInstance(object); 5634 MigrateInstance(object);
5634 } 5635 }
5635 5636
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
5737 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 5738 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
5738 case EXTERNAL_INT_ELEMENTS: 5739 case EXTERNAL_INT_ELEMENTS:
5739 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 5740 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
5740 case EXTERNAL_FLOAT_ELEMENTS: 5741 case EXTERNAL_FLOAT_ELEMENTS:
5741 case EXTERNAL_DOUBLE_ELEMENTS: 5742 case EXTERNAL_DOUBLE_ELEMENTS:
5742 case FAST_DOUBLE_ELEMENTS: 5743 case FAST_DOUBLE_ELEMENTS:
5743 case FAST_HOLEY_DOUBLE_ELEMENTS: 5744 case FAST_HOLEY_DOUBLE_ELEMENTS:
5744 // No contained objects, nothing to do. 5745 // No contained objects, nothing to do.
5745 break; 5746 break;
5746 } 5747 }
5747 return copy; 5748 return handle_scope.CloseAndEscape(copy);
5748 } 5749 }
5749 5750
5750 5751
5751 // Tests for the fast common case for property enumeration: 5752 // Tests for the fast common case for property enumeration:
5752 // - This object and all prototypes has an enum cache (which means that 5753 // - This object and all prototypes has an enum cache (which means that
5753 // it is no proxy, has no interceptors and needs no access checks). 5754 // it is no proxy, has no interceptors and needs no access checks).
5754 // - This object has no elements. 5755 // - This object has no elements.
5755 // - No prototype has enumerable properties/elements. 5756 // - No prototype has enumerable properties/elements.
5756 bool JSReceiver::IsSimpleEnum() { 5757 bool JSReceiver::IsSimpleEnum() {
5757 Heap* heap = GetHeap(); 5758 Heap* heap = GetHeap();
(...skipping 10384 matching lines...) Expand 10 before | Expand all | Expand 10 after
16142 #define ERROR_MESSAGES_TEXTS(C, T) T, 16143 #define ERROR_MESSAGES_TEXTS(C, T) T,
16143 static const char* error_messages_[] = { 16144 static const char* error_messages_[] = {
16144 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16145 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16145 }; 16146 };
16146 #undef ERROR_MESSAGES_TEXTS 16147 #undef ERROR_MESSAGES_TEXTS
16147 return error_messages_[reason]; 16148 return error_messages_[reason];
16148 } 16149 }
16149 16150
16150 16151
16151 } } // namespace v8::internal 16152 } } // 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