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

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

Issue 1306303003: [es6] Implement spec compliant ToPrimitive in the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michis comments. Created 5 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 return IsSmi(); 1125 return IsSmi();
1126 } else if (FLAG_track_double_fields && representation.IsDouble()) { 1126 } else if (FLAG_track_double_fields && representation.IsDouble()) {
1127 return IsMutableHeapNumber() || IsNumber(); 1127 return IsMutableHeapNumber() || IsNumber();
1128 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 1128 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
1129 return IsHeapObject(); 1129 return IsHeapObject();
1130 } 1130 }
1131 return true; 1131 return true;
1132 } 1132 }
1133 1133
1134 1134
1135 // static
1135 MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate, 1136 MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
1136 Handle<Object> object) { 1137 Handle<Object> object) {
1137 return ToObject( 1138 return ToObject(
1138 isolate, object, handle(isolate->context()->native_context(), isolate)); 1139 isolate, object, handle(isolate->context()->native_context(), isolate));
1139 } 1140 }
1140 1141
1141 1142
1143 // static
1144 MaybeHandle<Name> Object::ToName(Isolate* isolate, Handle<Object> input) {
1145 if (input->IsName()) return Handle<Name>::cast(input);
1146 return ToString(isolate, input);
1147 }
1148
1149
1150 // static
1151 MaybeHandle<Object> Object::ToPrimitive(Handle<Object> input,
1152 ToPrimitiveHint hint) {
1153 if (input->IsPrimitive()) return input;
1154 return JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(input), hint);
1155 }
1156
1157
1142 bool Object::HasSpecificClassOf(String* name) { 1158 bool Object::HasSpecificClassOf(String* name) {
1143 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); 1159 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
1144 } 1160 }
1145 1161
1146 1162
1147 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, 1163 MaybeHandle<Object> Object::GetProperty(Handle<Object> object,
1148 Handle<Name> name, 1164 Handle<Name> name,
1149 LanguageMode language_mode) { 1165 LanguageMode language_mode) {
1150 LookupIterator it(object, name); 1166 LookupIterator it(object, name);
1151 return GetProperty(&it, language_mode); 1167 return GetProperty(&it, language_mode);
(...skipping 6718 matching lines...) Expand 10 before | Expand all | Expand 10 after
7870 #undef READ_INT64_FIELD 7886 #undef READ_INT64_FIELD
7871 #undef WRITE_INT64_FIELD 7887 #undef WRITE_INT64_FIELD
7872 #undef READ_BYTE_FIELD 7888 #undef READ_BYTE_FIELD
7873 #undef WRITE_BYTE_FIELD 7889 #undef WRITE_BYTE_FIELD
7874 #undef NOBARRIER_READ_BYTE_FIELD 7890 #undef NOBARRIER_READ_BYTE_FIELD
7875 #undef NOBARRIER_WRITE_BYTE_FIELD 7891 #undef NOBARRIER_WRITE_BYTE_FIELD
7876 7892
7877 } } // namespace v8::internal 7893 } } // namespace v8::internal
7878 7894
7879 #endif // V8_OBJECTS_INL_H_ 7895 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.cc ('K') | « src/objects.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698