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

Side by Side Diff: src/objects.cc

Issue 1642223003: [api] Make ObjectTemplate::SetNativeDataProperty() work even if the ObjectTemplate does not have a … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 8218 matching lines...) Expand 10 before | Expand all | Expand 10 after
8229 Handle<JSObject> object, 8229 Handle<JSObject> object,
8230 AllocationSiteUsageContext* site_context, 8230 AllocationSiteUsageContext* site_context,
8231 DeepCopyHints hints) { 8231 DeepCopyHints hints) {
8232 JSObjectWalkVisitor<AllocationSiteUsageContext> v(site_context, true, hints); 8232 JSObjectWalkVisitor<AllocationSiteUsageContext> v(site_context, true, hints);
8233 MaybeHandle<JSObject> copy = v.StructureWalk(object); 8233 MaybeHandle<JSObject> copy = v.StructureWalk(object);
8234 Handle<JSObject> for_assert; 8234 Handle<JSObject> for_assert;
8235 DCHECK(!copy.ToHandle(&for_assert) || !for_assert.is_identical_to(object)); 8235 DCHECK(!copy.ToHandle(&for_assert) || !for_assert.is_identical_to(object));
8236 return copy; 8236 return copy;
8237 } 8237 }
8238 8238
8239 class DummyContextObject : public AllocationSiteContext {
8240 public:
8241 explicit DummyContextObject(Isolate* isolate)
8242 : AllocationSiteContext(isolate) {}
8243
8244 bool ShouldCreateMemento(Handle<JSObject> object) { return false; }
8245 Handle<AllocationSite> EnterNewScope() { return Handle<AllocationSite>(); }
8246 void ExitScope(Handle<AllocationSite> site, Handle<JSObject> object) {}
8247 };
8248
8249 MaybeHandle<JSObject> JSObject::DeepCopy(Handle<JSObject> object,
8250 DeepCopyHints hints) {
8251 DummyContextObject dummy_context_object(object->GetIsolate());
8252 JSObjectWalkVisitor<DummyContextObject> v(&dummy_context_object, true, hints);
8253 MaybeHandle<JSObject> copy = v.StructureWalk(object);
8254 Handle<JSObject> for_assert;
8255 DCHECK(!copy.ToHandle(&for_assert) || !for_assert.is_identical_to(object));
8256 return copy;
8257 }
8239 8258
8240 // static 8259 // static
8241 MaybeHandle<Object> JSReceiver::ToPrimitive(Handle<JSReceiver> receiver, 8260 MaybeHandle<Object> JSReceiver::ToPrimitive(Handle<JSReceiver> receiver,
8242 ToPrimitiveHint hint) { 8261 ToPrimitiveHint hint) {
8243 Isolate* const isolate = receiver->GetIsolate(); 8262 Isolate* const isolate = receiver->GetIsolate();
8244 Handle<Object> exotic_to_prim; 8263 Handle<Object> exotic_to_prim;
8245 ASSIGN_RETURN_ON_EXCEPTION( 8264 ASSIGN_RETURN_ON_EXCEPTION(
8246 isolate, exotic_to_prim, 8265 isolate, exotic_to_prim,
8247 GetMethod(receiver, isolate->factory()->to_primitive_symbol()), Object); 8266 GetMethod(receiver, isolate->factory()->to_primitive_symbol()), Object);
8248 if (!exotic_to_prim->IsUndefined()) { 8267 if (!exotic_to_prim->IsUndefined()) {
(...skipping 11500 matching lines...) Expand 10 before | Expand all | Expand 10 after
19749 if (cell->value() != *new_value) { 19768 if (cell->value() != *new_value) {
19750 cell->set_value(*new_value); 19769 cell->set_value(*new_value);
19751 Isolate* isolate = cell->GetIsolate(); 19770 Isolate* isolate = cell->GetIsolate();
19752 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19771 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19753 isolate, DependentCode::kPropertyCellChangedGroup); 19772 isolate, DependentCode::kPropertyCellChangedGroup);
19754 } 19773 }
19755 } 19774 }
19756 19775
19757 } // namespace internal 19776 } // namespace internal
19758 } // namespace v8 19777 } // namespace v8
OLDNEW
« src/builtins.cc ('K') | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698