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

Side by Side Diff: src/objects-inl.h

Issue 234893003: Revert "Handlify GetProperty." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | « src/objects.cc ('k') | src/runtime.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 } 1074 }
1075 return Failure::Exception(); 1075 return Failure::Exception();
1076 } 1076 }
1077 1077
1078 1078
1079 bool Object::HasSpecificClassOf(String* name) { 1079 bool Object::HasSpecificClassOf(String* name) {
1080 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); 1080 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
1081 } 1081 }
1082 1082
1083 1083
1084 MaybeHandle<Object> Object::GetProperty(Handle<Object> object,
1085 Handle<Name> name) {
1086 PropertyAttributes attributes;
1087 return GetPropertyWithReceiver(object, object, name, &attributes);
1088 }
1089
1090
1091 MaybeHandle<Object> Object::GetElement(Isolate* isolate, 1084 MaybeHandle<Object> Object::GetElement(Isolate* isolate,
1092 Handle<Object> object, 1085 Handle<Object> object,
1093 uint32_t index) { 1086 uint32_t index) {
1094 // GetElement can trigger a getter which can cause allocation. 1087 // GetElement can trigger a getter which can cause allocation.
1095 // This was not always the case. This ASSERT is here to catch 1088 // This was not always the case. This ASSERT is here to catch
1096 // leftover incorrect uses. 1089 // leftover incorrect uses.
1097 ASSERT(AllowHeapAllocation::IsAllowed()); 1090 ASSERT(AllowHeapAllocation::IsAllowed());
1098 return Object::GetElementWithReceiver(isolate, object, object, index); 1091 return Object::GetElementWithReceiver(isolate, object, object, index);
1099 } 1092 }
1100 1093
1101 1094
1102 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, 1095 Handle<Object> Object::GetElementNoExceptionThrown(Isolate* isolate,
1103 Handle<Name> name) { 1096 Handle<Object> object,
1104 uint32_t index; 1097 uint32_t index) {
1105 Isolate* isolate = name->GetIsolate(); 1098 Handle<Object> result =
1106 if (name->AsArrayIndex(&index)) return GetElement(isolate, object, index); 1099 Object::GetElementWithReceiver(
1107 return GetProperty(object, name); 1100 isolate, object, object, index).ToHandleChecked();
1101 return result;
1108 } 1102 }
1109 1103
1110 1104
1111 MaybeHandle<Object> JSProxy::GetElementWithHandler(Handle<JSProxy> proxy, 1105 MaybeObject* Object::GetProperty(Name* key) {
1112 Handle<Object> receiver, 1106 PropertyAttributes attributes;
1113 uint32_t index) { 1107 return GetPropertyWithReceiver(this, key, &attributes);
1114 return GetPropertyWithHandler(
1115 proxy, receiver, proxy->GetIsolate()->factory()->Uint32ToString(index));
1116 } 1108 }
1117 1109
1118 1110
1119 MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy,
1120 Handle<JSReceiver> receiver,
1121 uint32_t index,
1122 Handle<Object> value,
1123 StrictMode strict_mode) {
1124 Isolate* isolate = proxy->GetIsolate();
1125 Handle<String> name = isolate->factory()->Uint32ToString(index);
1126 return SetPropertyWithHandler(
1127 proxy, receiver, name, value, NONE, strict_mode);
1128 }
1129
1130
1131 bool JSProxy::HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index) {
1132 Isolate* isolate = proxy->GetIsolate();
1133 Handle<String> name = isolate->factory()->Uint32ToString(index);
1134 return HasPropertyWithHandler(proxy, name);
1135 }
1136
1137
1138 #define FIELD_ADDR(p, offset) \ 1111 #define FIELD_ADDR(p, offset) \
1139 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) 1112 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag)
1140 1113
1141 #define READ_FIELD(p, offset) \ 1114 #define READ_FIELD(p, offset) \
1142 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) 1115 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)))
1143 1116
1144 #define ACQUIRE_READ_FIELD(p, offset) \ 1117 #define ACQUIRE_READ_FIELD(p, offset) \
1145 reinterpret_cast<Object*>( \ 1118 reinterpret_cast<Object*>( \
1146 Acquire_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset)))) 1119 Acquire_Load(reinterpret_cast<AtomicWord*>(FIELD_ADDR(p, offset))))
1147 1120
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after
3044 3017
3045 3018
3046 void Name::set_hash_field(uint32_t value) { 3019 void Name::set_hash_field(uint32_t value) {
3047 WRITE_UINT32_FIELD(this, kHashFieldOffset, value); 3020 WRITE_UINT32_FIELD(this, kHashFieldOffset, value);
3048 #if V8_HOST_ARCH_64_BIT 3021 #if V8_HOST_ARCH_64_BIT
3049 WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0); 3022 WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0);
3050 #endif 3023 #endif
3051 } 3024 }
3052 3025
3053 3026
3027 Handle<Object> GlobalObject::GetPropertyNoExceptionThrown(
3028 Handle<GlobalObject> global,
3029 Handle<Name> name) {
3030 Handle<Object> result = Object::GetProperty(global, name);
3031 CHECK_NOT_EMPTY_HANDLE(name->GetIsolate(), result);
3032 return result;
3033 }
3034
3035
3054 bool Name::Equals(Name* other) { 3036 bool Name::Equals(Name* other) {
3055 if (other == this) return true; 3037 if (other == this) return true;
3056 if ((this->IsInternalizedString() && other->IsInternalizedString()) || 3038 if ((this->IsInternalizedString() && other->IsInternalizedString()) ||
3057 this->IsSymbol() || other->IsSymbol()) { 3039 this->IsSymbol() || other->IsSymbol()) {
3058 return false; 3040 return false;
3059 } 3041 }
3060 return String::cast(this)->SlowEquals(String::cast(other)); 3042 return String::cast(this)->SlowEquals(String::cast(other));
3061 } 3043 }
3062 3044
3063 3045
(...skipping 4042 matching lines...) Expand 10 before | Expand all | Expand 10 after
7106 #undef READ_SHORT_FIELD 7088 #undef READ_SHORT_FIELD
7107 #undef WRITE_SHORT_FIELD 7089 #undef WRITE_SHORT_FIELD
7108 #undef READ_BYTE_FIELD 7090 #undef READ_BYTE_FIELD
7109 #undef WRITE_BYTE_FIELD 7091 #undef WRITE_BYTE_FIELD
7110 #undef NOBARRIER_READ_BYTE_FIELD 7092 #undef NOBARRIER_READ_BYTE_FIELD
7111 #undef NOBARRIER_WRITE_BYTE_FIELD 7093 #undef NOBARRIER_WRITE_BYTE_FIELD
7112 7094
7113 } } // namespace v8::internal 7095 } } // namespace v8::internal
7114 7096
7115 #endif // V8_OBJECTS_INL_H_ 7097 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698