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

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

Issue 897633003: Add macro for getting a PropertyAttributes for the runtime functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 5 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
« no previous file with comments | « no previous file | src/runtime/runtime-utils.h » ('j') | 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/v8.h" 5 #include "src/v8.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.h" 9 #include "src/debug.h"
10 #include "src/runtime/runtime.h" 10 #include "src/runtime/runtime.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 return JSObject::SetElement(js_object, index, value, NONE, language_mode, 187 return JSObject::SetElement(js_object, index, value, NONE, language_mode,
188 true, SET_PROPERTY); 188 true, SET_PROPERTY);
189 } 189 }
190 return Object::SetProperty(object, name, value, language_mode); 190 return Object::SetProperty(object, name, value, language_mode);
191 } 191 }
192 192
193 193
194 MaybeHandle<Object> Runtime::DefineObjectProperty(Handle<JSObject> js_object, 194 MaybeHandle<Object> Runtime::DefineObjectProperty(Handle<JSObject> js_object,
195 Handle<Object> key, 195 Handle<Object> key,
196 Handle<Object> value, 196 Handle<Object> value,
197 PropertyAttributes attr) { 197 PropertyAttributes attrs) {
198 Isolate* isolate = js_object->GetIsolate(); 198 Isolate* isolate = js_object->GetIsolate();
199 // Check if the given key is an array index. 199 // Check if the given key is an array index.
200 uint32_t index; 200 uint32_t index;
201 if (key->ToArrayIndex(&index)) { 201 if (key->ToArrayIndex(&index)) {
202 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters 202 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters
203 // of a string using [] notation. We need to support this too in 203 // of a string using [] notation. We need to support this too in
204 // JavaScript. 204 // JavaScript.
205 // In the case of a String object we just need to redirect the assignment to 205 // In the case of a String object we just need to redirect the assignment to
206 // the underlying string if the index is in range. Since the underlying 206 // the underlying string if the index is in range. Since the underlying
207 // string does nothing with the assignment then we can ignore such 207 // string does nothing with the assignment then we can ignore such
208 // assignments. 208 // assignments.
209 if (js_object->IsStringObjectWithCharacterAt(index)) { 209 if (js_object->IsStringObjectWithCharacterAt(index)) {
210 return value; 210 return value;
211 } 211 }
212 212
213 return JSObject::SetElement(js_object, index, value, attr, SLOPPY, false, 213 return JSObject::SetElement(js_object, index, value, attrs, SLOPPY, false,
214 DEFINE_PROPERTY); 214 DEFINE_PROPERTY);
215 } 215 }
216 216
217 if (key->IsName()) { 217 if (key->IsName()) {
218 Handle<Name> name = Handle<Name>::cast(key); 218 Handle<Name> name = Handle<Name>::cast(key);
219 if (name->AsArrayIndex(&index)) { 219 if (name->AsArrayIndex(&index)) {
220 return JSObject::SetElement(js_object, index, value, attr, SLOPPY, false, 220 return JSObject::SetElement(js_object, index, value, attrs, SLOPPY, false,
221 DEFINE_PROPERTY); 221 DEFINE_PROPERTY);
222 } else { 222 } else {
223 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name)); 223 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name));
224 return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name, value, 224 return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name, value,
225 attr); 225 attrs);
226 } 226 }
227 } 227 }
228 228
229 // Call-back into JavaScript to convert the key to a string. 229 // Call-back into JavaScript to convert the key to a string.
230 Handle<Object> converted; 230 Handle<Object> converted;
231 ASSIGN_RETURN_ON_EXCEPTION(isolate, converted, 231 ASSIGN_RETURN_ON_EXCEPTION(isolate, converted,
232 Execution::ToString(isolate, key), Object); 232 Execution::ToString(isolate, key), Object);
233 Handle<String> name = Handle<String>::cast(converted); 233 Handle<String> name = Handle<String>::cast(converted);
234 234
235 if (name->AsArrayIndex(&index)) { 235 if (name->AsArrayIndex(&index)) {
236 return JSObject::SetElement(js_object, index, value, attr, SLOPPY, false, 236 return JSObject::SetElement(js_object, index, value, attrs, SLOPPY, false,
237 DEFINE_PROPERTY); 237 DEFINE_PROPERTY);
238 } else { 238 } else {
239 return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name, value, 239 return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name, value,
240 attr); 240 attrs);
241 } 241 }
242 } 242 }
243 243
244 244
245 MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate, 245 MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate,
246 Handle<Object> obj) { 246 Handle<Object> obj) {
247 // We don't expect access checks to be needed on JSProxy objects. 247 // We don't expect access checks to be needed on JSProxy objects.
248 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); 248 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject());
249 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); 249 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER);
250 do { 250 do {
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 657 }
658 658
659 659
660 RUNTIME_FUNCTION(Runtime_AddNamedProperty) { 660 RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
661 HandleScope scope(isolate); 661 HandleScope scope(isolate);
662 RUNTIME_ASSERT(args.length() == 4); 662 RUNTIME_ASSERT(args.length() == 4);
663 663
664 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 664 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
665 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); 665 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
666 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); 666 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
667 CONVERT_SMI_ARG_CHECKED(unchecked_attributes, 3); 667 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
668 RUNTIME_ASSERT(
669 (unchecked_attributes & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
670 // Compute attributes.
671 PropertyAttributes attributes =
672 static_cast<PropertyAttributes>(unchecked_attributes);
673 668
674 #ifdef DEBUG 669 #ifdef DEBUG
675 uint32_t index = 0; 670 uint32_t index = 0;
676 DCHECK(!key->ToArrayIndex(&index)); 671 DCHECK(!key->ToArrayIndex(&index));
677 LookupIterator it(object, key, LookupIterator::OWN_SKIP_INTERCEPTOR); 672 LookupIterator it(object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
678 Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); 673 Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
679 if (!maybe.has_value) return isolate->heap()->exception(); 674 if (!maybe.has_value) return isolate->heap()->exception();
680 RUNTIME_ASSERT(!it.IsFound()); 675 RUNTIME_ASSERT(!it.IsFound());
681 #endif 676 #endif
682 677
683 Handle<Object> result; 678 Handle<Object> result;
684 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 679 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
685 isolate, result, 680 isolate, result,
686 JSObject::SetOwnPropertyIgnoreAttributes(object, key, value, attributes)); 681 JSObject::SetOwnPropertyIgnoreAttributes(object, key, value, attrs));
687 return *result; 682 return *result;
688 } 683 }
689 684
690 685
691 RUNTIME_FUNCTION(Runtime_SetProperty) { 686 RUNTIME_FUNCTION(Runtime_SetProperty) {
692 HandleScope scope(isolate); 687 HandleScope scope(isolate);
693 RUNTIME_ASSERT(args.length() == 4); 688 RUNTIME_ASSERT(args.length() == 4);
694 689
695 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 690 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
696 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 691 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
(...skipping 11 matching lines...) Expand all
708 703
709 // Adds an element to an array. 704 // Adds an element to an array.
710 // This is used to create an indexed data property into an array. 705 // This is used to create an indexed data property into an array.
711 RUNTIME_FUNCTION(Runtime_AddElement) { 706 RUNTIME_FUNCTION(Runtime_AddElement) {
712 HandleScope scope(isolate); 707 HandleScope scope(isolate);
713 RUNTIME_ASSERT(args.length() == 4); 708 RUNTIME_ASSERT(args.length() == 4);
714 709
715 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 710 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
716 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 711 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
717 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); 712 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
718 CONVERT_SMI_ARG_CHECKED(unchecked_attributes, 3); 713 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
719 RUNTIME_ASSERT(
720 (unchecked_attributes & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
721 // Compute attributes.
722 PropertyAttributes attributes =
723 static_cast<PropertyAttributes>(unchecked_attributes);
724 714
725 uint32_t index = 0; 715 uint32_t index = 0;
726 key->ToArrayIndex(&index); 716 key->ToArrayIndex(&index);
727 717
728 Handle<Object> result; 718 Handle<Object> result;
729 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 719 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
730 isolate, result, JSObject::SetElement(object, index, value, attributes, 720 isolate, result, JSObject::SetElement(object, index, value, attrs, SLOPPY,
731 SLOPPY, false, DEFINE_PROPERTY)); 721 false, DEFINE_PROPERTY));
732 return *result; 722 return *result;
733 } 723 }
734 724
735 725
736 RUNTIME_FUNCTION(Runtime_DeleteProperty) { 726 RUNTIME_FUNCTION(Runtime_DeleteProperty) {
737 HandleScope scope(isolate); 727 HandleScope scope(isolate);
738 DCHECK(args.length() == 3); 728 DCHECK(args.length() == 3);
739 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); 729 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
740 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); 730 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
741 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 2); 731 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 2);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 // Return the names of the own indexed properties. 1020 // Return the names of the own indexed properties.
1031 // args[0]: object 1021 // args[0]: object
1032 RUNTIME_FUNCTION(Runtime_GetOwnElementNames) { 1022 RUNTIME_FUNCTION(Runtime_GetOwnElementNames) {
1033 HandleScope scope(isolate); 1023 HandleScope scope(isolate);
1034 DCHECK(args.length() == 1); 1024 DCHECK(args.length() == 1);
1035 if (!args[0]->IsJSObject()) { 1025 if (!args[0]->IsJSObject()) {
1036 return isolate->heap()->undefined_value(); 1026 return isolate->heap()->undefined_value();
1037 } 1027 }
1038 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 1028 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
1039 1029
1040 int n = obj->NumberOfOwnElements(static_cast<PropertyAttributes>(NONE)); 1030 int n = obj->NumberOfOwnElements(NONE);
1041 Handle<FixedArray> names = isolate->factory()->NewFixedArray(n); 1031 Handle<FixedArray> names = isolate->factory()->NewFixedArray(n);
1042 obj->GetOwnElementKeys(*names, static_cast<PropertyAttributes>(NONE)); 1032 obj->GetOwnElementKeys(*names, NONE);
1043 return *isolate->factory()->NewJSArrayWithElements(names); 1033 return *isolate->factory()->NewJSArrayWithElements(names);
1044 } 1034 }
1045 1035
1046 1036
1047 // Return information on whether an object has a named or indexed interceptor. 1037 // Return information on whether an object has a named or indexed interceptor.
1048 // args[0]: object 1038 // args[0]: object
1049 RUNTIME_FUNCTION(Runtime_GetInterceptorInfo) { 1039 RUNTIME_FUNCTION(Runtime_GetInterceptorInfo) {
1050 HandleScope scope(isolate); 1040 HandleScope scope(isolate);
1051 DCHECK(args.length() == 1); 1041 DCHECK(args.length() == 1);
1052 if (!args[0]->IsJSObject()) { 1042 if (!args[0]->IsJSObject()) {
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) { 1427 RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) {
1438 HandleScope scope(isolate); 1428 HandleScope scope(isolate);
1439 DCHECK(args.length() == 5); 1429 DCHECK(args.length() == 5);
1440 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 1430 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
1441 RUNTIME_ASSERT(!obj->IsNull()); 1431 RUNTIME_ASSERT(!obj->IsNull());
1442 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); 1432 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
1443 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); 1433 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2);
1444 RUNTIME_ASSERT(IsValidAccessor(getter)); 1434 RUNTIME_ASSERT(IsValidAccessor(getter));
1445 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); 1435 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3);
1446 RUNTIME_ASSERT(IsValidAccessor(setter)); 1436 RUNTIME_ASSERT(IsValidAccessor(setter));
1447 CONVERT_SMI_ARG_CHECKED(unchecked, 4); 1437 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 4);
1448 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
1449 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
1450 1438
1451 RETURN_FAILURE_ON_EXCEPTION( 1439 RETURN_FAILURE_ON_EXCEPTION(
1452 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attr)); 1440 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attrs));
1453 return isolate->heap()->undefined_value(); 1441 return isolate->heap()->undefined_value();
1454 } 1442 }
1455 1443
1456 1444
1457 // Implements part of 8.12.9 DefineOwnProperty. 1445 // Implements part of 8.12.9 DefineOwnProperty.
1458 // There are 3 cases that lead here: 1446 // There are 3 cases that lead here:
1459 // Step 4a - define a new data property. 1447 // Step 4a - define a new data property.
1460 // Steps 9b & 12 - replace an existing accessor property with a data property. 1448 // Steps 9b & 12 - replace an existing accessor property with a data property.
1461 // Step 12 - update an existing data property with a data or generic 1449 // Step 12 - update an existing data property with a data or generic
1462 // descriptor. 1450 // descriptor.
1463 RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) { 1451 RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) {
1464 HandleScope scope(isolate); 1452 HandleScope scope(isolate);
1465 DCHECK(args.length() == 4); 1453 DCHECK(args.length() == 4);
1466 CONVERT_ARG_HANDLE_CHECKED(JSObject, js_object, 0); 1454 CONVERT_ARG_HANDLE_CHECKED(JSObject, js_object, 0);
1467 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); 1455 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
1468 CONVERT_ARG_HANDLE_CHECKED(Object, obj_value, 2); 1456 CONVERT_ARG_HANDLE_CHECKED(Object, obj_value, 2);
1469 CONVERT_SMI_ARG_CHECKED(unchecked, 3); 1457 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
1470 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
1471 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
1472 1458
1473 LookupIterator it(js_object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); 1459 LookupIterator it(js_object, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
1474 if (it.IsFound() && it.state() == LookupIterator::ACCESS_CHECK) { 1460 if (it.IsFound() && it.state() == LookupIterator::ACCESS_CHECK) {
1475 if (!isolate->MayNamedAccess(js_object, name, v8::ACCESS_SET)) { 1461 if (!isolate->MayNamedAccess(js_object, name, v8::ACCESS_SET)) {
1476 return isolate->heap()->undefined_value(); 1462 return isolate->heap()->undefined_value();
1477 } 1463 }
1478 it.Next(); 1464 it.Next();
1479 } 1465 }
1480 1466
1481 // Take special care when attributes are different and there is already 1467 // Take special care when attributes are different and there is already
1482 // a property. 1468 // a property.
1483 if (it.state() == LookupIterator::ACCESSOR) { 1469 if (it.state() == LookupIterator::ACCESSOR) {
1484 // Use IgnoreAttributes version since a readonly property may be 1470 // Use IgnoreAttributes version since a readonly property may be
1485 // overridden and SetProperty does not allow this. 1471 // overridden and SetProperty does not allow this.
1486 Handle<Object> result; 1472 Handle<Object> result;
1487 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1473 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1488 isolate, result, 1474 isolate, result,
1489 JSObject::SetOwnPropertyIgnoreAttributes( 1475 JSObject::SetOwnPropertyIgnoreAttributes(
1490 js_object, name, obj_value, attr, JSObject::DONT_FORCE_FIELD)); 1476 js_object, name, obj_value, attrs, JSObject::DONT_FORCE_FIELD));
1491 return *result; 1477 return *result;
1492 } 1478 }
1493 1479
1494 Handle<Object> result; 1480 Handle<Object> result;
1495 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1481 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1496 isolate, result, 1482 isolate, result,
1497 Runtime::DefineObjectProperty(js_object, name, obj_value, attr)); 1483 Runtime::DefineObjectProperty(js_object, name, obj_value, attrs));
1498 return *result; 1484 return *result;
1499 } 1485 }
1500 1486
1501 1487
1502 // Return property without being observable by accessors or interceptors. 1488 // Return property without being observable by accessors or interceptors.
1503 RUNTIME_FUNCTION(Runtime_GetDataProperty) { 1489 RUNTIME_FUNCTION(Runtime_GetDataProperty) {
1504 HandleScope scope(isolate); 1490 HandleScope scope(isolate);
1505 DCHECK(args.length() == 2); 1491 DCHECK(args.length() == 2);
1506 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 1492 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
1507 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); 1493 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 return JSReceiver::cast(obj)->class_name(); 1572 return JSReceiver::cast(obj)->class_name();
1587 } 1573 }
1588 1574
1589 1575
1590 RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) { 1576 RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) {
1591 HandleScope scope(isolate); 1577 HandleScope scope(isolate);
1592 DCHECK(args.length() == 4); 1578 DCHECK(args.length() == 4);
1593 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 1579 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
1594 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); 1580 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
1595 CONVERT_ARG_HANDLE_CHECKED(JSFunction, getter, 2); 1581 CONVERT_ARG_HANDLE_CHECKED(JSFunction, getter, 2);
1596 CONVERT_SMI_ARG_CHECKED(unchecked, 3); 1582 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
1597 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
1598 PropertyAttributes attrs = static_cast<PropertyAttributes>(unchecked);
1599 1583
1600 RETURN_FAILURE_ON_EXCEPTION( 1584 RETURN_FAILURE_ON_EXCEPTION(
1601 isolate, 1585 isolate,
1602 JSObject::DefineAccessor(object, name, getter, 1586 JSObject::DefineAccessor(object, name, getter,
1603 isolate->factory()->null_value(), attrs)); 1587 isolate->factory()->null_value(), attrs));
1604 return isolate->heap()->undefined_value(); 1588 return isolate->heap()->undefined_value();
1605 } 1589 }
1606 1590
1607 1591
1608 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { 1592 RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) {
1609 HandleScope scope(isolate); 1593 HandleScope scope(isolate);
1610 DCHECK(args.length() == 4); 1594 DCHECK(args.length() == 4);
1611 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 1595 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
1612 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); 1596 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
1613 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); 1597 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2);
1614 CONVERT_SMI_ARG_CHECKED(unchecked, 3); 1598 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
1615 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
1616 PropertyAttributes attrs = static_cast<PropertyAttributes>(unchecked);
1617 1599
1618 RETURN_FAILURE_ON_EXCEPTION( 1600 RETURN_FAILURE_ON_EXCEPTION(
1619 isolate, 1601 isolate,
1620 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), 1602 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
1621 setter, attrs)); 1603 setter, attrs));
1622 return isolate->heap()->undefined_value(); 1604 return isolate->heap()->undefined_value();
1623 } 1605 }
1624 } 1606 }
1625 } // namespace v8::internal 1607 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/runtime/runtime-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698