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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 2316233004: Class fields, part 2 (desugaring) (Closed)
Patch Set: rebase harder Created 4 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
« no previous file with comments | « src/runtime/runtime.h ('k') | 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 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 "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 LookupIterator it = LookupIterator::PropertyOrElement( 669 LookupIterator it = LookupIterator::PropertyOrElement(
670 isolate, object, name, object, LookupIterator::OWN); 670 isolate, object, name, object, LookupIterator::OWN);
671 // Cannot fail since this should only be called when 671 // Cannot fail since this should only be called when
672 // creating an object literal. 672 // creating an object literal.
673 CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs, 673 CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs,
674 Object::DONT_THROW) 674 Object::DONT_THROW)
675 .IsJust()); 675 .IsJust());
676 return *object; 676 return *object;
677 } 677 }
678 678
679 RUNTIME_FUNCTION(Runtime_DefineDataProperty) {
680 HandleScope scope(isolate);
681 DCHECK(args.length() == 5);
682 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
683 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
684 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
685 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
686 CONVERT_SMI_ARG_CHECKED(set_function_name, 4);
687
688 if (set_function_name) {
689 DCHECK(value->IsJSFunction());
690 JSFunction::SetName(Handle<JSFunction>::cast(value), name,
691 isolate->factory()->empty_string());
692 }
693
694 PropertyDescriptor desc;
695 desc.set_writable(!(attrs & ReadOnly));
696 desc.set_enumerable(!(attrs & DontEnum));
697 desc.set_configurable(!(attrs & DontDelete));
698 desc.set_value(value);
699
700 Maybe<bool> result = JSReceiver::DefineOwnProperty(isolate, receiver, name,
701 &desc, Object::DONT_THROW);
702 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
703 if (result.IsNothing()) {
704 DCHECK(isolate->has_pending_exception());
705 return isolate->heap()->exception();
706 }
707
708 return *receiver;
709 }
710
679 // Return property without being observable by accessors or interceptors. 711 // Return property without being observable by accessors or interceptors.
680 RUNTIME_FUNCTION(Runtime_GetDataProperty) { 712 RUNTIME_FUNCTION(Runtime_GetDataProperty) {
681 HandleScope scope(isolate); 713 HandleScope scope(isolate);
682 DCHECK(args.length() == 2); 714 DCHECK(args.length() == 2);
683 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); 715 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
684 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); 716 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
685 return *JSReceiver::GetDataProperty(object, name); 717 return *JSReceiver::GetDataProperty(object, name);
686 } 718 }
687 719
688 RUNTIME_FUNCTION(Runtime_GetConstructorName) { 720 RUNTIME_FUNCTION(Runtime_GetConstructorName) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 isolate, o, key, &success, LookupIterator::OWN); 954 isolate, o, key, &success, LookupIterator::OWN);
923 if (!success) return isolate->heap()->exception(); 955 if (!success) return isolate->heap()->exception();
924 MAYBE_RETURN( 956 MAYBE_RETURN(
925 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), 957 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR),
926 isolate->heap()->exception()); 958 isolate->heap()->exception());
927 return *value; 959 return *value;
928 } 960 }
929 961
930 } // namespace internal 962 } // namespace internal
931 } // namespace v8 963 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698