| OLD | NEW |
| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 if (HasInterceptorGetter(*holder)) { | 427 if (HasInterceptorGetter(*holder)) { |
| 428 return; | 428 return; |
| 429 } | 429 } |
| 430 | 430 |
| 431 holder->LocalLookupRealNamedProperty(*name, lookup); | 431 holder->LocalLookupRealNamedProperty(*name, lookup); |
| 432 if (lookup->IsFound()) { | 432 if (lookup->IsFound()) { |
| 433 ASSERT(!lookup->IsInterceptor()); | 433 ASSERT(!lookup->IsInterceptor()); |
| 434 return; | 434 return; |
| 435 } | 435 } |
| 436 | 436 |
| 437 Handle<Object> proto(holder->GetPrototype()); | 437 Handle<Object> proto(holder->GetPrototype(), name->GetIsolate()); |
| 438 if (proto->IsNull()) { | 438 if (proto->IsNull()) { |
| 439 ASSERT(!lookup->IsFound()); | 439 ASSERT(!lookup->IsFound()); |
| 440 return; | 440 return; |
| 441 } | 441 } |
| 442 | 442 |
| 443 object = proto; | 443 object = proto; |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 | 446 |
| 447 | 447 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 458 frame->SetExpression(index, *object); | 458 frame->SetExpression(index, *object); |
| 459 } | 459 } |
| 460 | 460 |
| 461 return delegate; | 461 return delegate; |
| 462 } | 462 } |
| 463 | 463 |
| 464 | 464 |
| 465 void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee, | 465 void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee, |
| 466 Handle<Object> object) { | 466 Handle<Object> object) { |
| 467 while (callee->IsJSFunctionProxy()) { | 467 while (callee->IsJSFunctionProxy()) { |
| 468 callee = Handle<Object>(JSFunctionProxy::cast(*callee)->call_trap()); | 468 callee = Handle<Object>(JSFunctionProxy::cast(*callee)->call_trap(), |
| 469 isolate()); |
| 469 } | 470 } |
| 470 | 471 |
| 471 if (callee->IsJSFunction()) { | 472 if (callee->IsJSFunction()) { |
| 472 Handle<JSFunction> function = Handle<JSFunction>::cast(callee); | 473 Handle<JSFunction> function = Handle<JSFunction>::cast(callee); |
| 473 if (!function->shared()->is_classic_mode() || function->IsBuiltin()) { | 474 if (!function->shared()->is_classic_mode() || function->IsBuiltin()) { |
| 474 // Do not wrap receiver for strict mode functions or for builtins. | 475 // Do not wrap receiver for strict mode functions or for builtins. |
| 475 return; | 476 return; |
| 476 } | 477 } |
| 477 } | 478 } |
| 478 | 479 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 if (receiver->elements()->map() == | 778 if (receiver->elements()->map() == |
| 778 isolate()->heap()->non_strict_arguments_elements_map()) { | 779 isolate()->heap()->non_strict_arguments_elements_map()) { |
| 779 stub = isolate()->stub_cache()->ComputeCallArguments(argc); | 780 stub = isolate()->stub_cache()->ComputeCallArguments(argc); |
| 780 } | 781 } |
| 781 } | 782 } |
| 782 ASSERT(!stub.is_null()); | 783 ASSERT(!stub.is_null()); |
| 783 set_target(*stub); | 784 set_target(*stub); |
| 784 TRACE_IC("KeyedCallIC", key, state, target()); | 785 TRACE_IC("KeyedCallIC", key, state, target()); |
| 785 } | 786 } |
| 786 | 787 |
| 787 Handle<Object> result = GetProperty(object, key); | 788 Handle<Object> result = GetProperty(isolate(), object, key); |
| 788 RETURN_IF_EMPTY_HANDLE(isolate(), result); | 789 RETURN_IF_EMPTY_HANDLE(isolate(), result); |
| 789 | 790 |
| 790 // Make receiver an object if the callee requires it. Strict mode or builtin | 791 // Make receiver an object if the callee requires it. Strict mode or builtin |
| 791 // functions do not wrap the receiver, non-strict functions and objects | 792 // functions do not wrap the receiver, non-strict functions and objects |
| 792 // called as functions do. | 793 // called as functions do. |
| 793 ReceiverToObjectIfRequired(result, object); | 794 ReceiverToObjectIfRequired(result, object); |
| 794 if (result->IsJSFunction()) return *result; | 795 if (result->IsJSFunction()) return *result; |
| 795 | 796 |
| 796 result = TryCallAsFunction(result); | 797 result = TryCallAsFunction(result); |
| 797 if (result->IsJSFunction()) return *result; | 798 if (result->IsJSFunction()) return *result; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 stub = megamorphic_stub(); | 831 stub = megamorphic_stub(); |
| 831 } | 832 } |
| 832 if (!stub.is_null()) { | 833 if (!stub.is_null()) { |
| 833 set_target(*stub); | 834 set_target(*stub); |
| 834 #ifdef DEBUG | 835 #ifdef DEBUG |
| 835 if (FLAG_trace_ic) PrintF("[LoadIC : +#length /string]\n"); | 836 if (FLAG_trace_ic) PrintF("[LoadIC : +#length /string]\n"); |
| 836 #endif | 837 #endif |
| 837 } | 838 } |
| 838 // Get the string if we have a string wrapper object. | 839 // Get the string if we have a string wrapper object. |
| 839 Handle<Object> string = object->IsJSValue() | 840 Handle<Object> string = object->IsJSValue() |
| 840 ? Handle<Object>(Handle<JSValue>::cast(object)->value()) | 841 ? Handle<Object>(Handle<JSValue>::cast(object)->value(), isolate()) |
| 841 : object; | 842 : object; |
| 842 return Smi::FromInt(String::cast(*string)->length()); | 843 return Smi::FromInt(String::cast(*string)->length()); |
| 843 } | 844 } |
| 844 | 845 |
| 845 // Use specialized code for getting the length of arrays. | 846 // Use specialized code for getting the length of arrays. |
| 846 if (object->IsJSArray() && | 847 if (object->IsJSArray() && |
| 847 name->Equals(isolate()->heap()->length_symbol())) { | 848 name->Equals(isolate()->heap()->length_symbol())) { |
| 848 Handle<Code> stub; | 849 Handle<Code> stub; |
| 849 if (state == UNINITIALIZED) { | 850 if (state == UNINITIALIZED) { |
| 850 stub = pre_monomorphic_stub(); | 851 stub = pre_monomorphic_stub(); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 return isolate()->stub_cache()->ComputeLoadGlobal( | 1045 return isolate()->stub_cache()->ComputeLoadGlobal( |
| 1045 name, receiver, global, cell, lookup->IsDontDelete()); | 1046 name, receiver, global, cell, lookup->IsDontDelete()); |
| 1046 } | 1047 } |
| 1047 // There is only one shared stub for loading normalized | 1048 // There is only one shared stub for loading normalized |
| 1048 // properties. It does not traverse the prototype chain, so the | 1049 // properties. It does not traverse the prototype chain, so the |
| 1049 // property must be found in the receiver for the stub to be | 1050 // property must be found in the receiver for the stub to be |
| 1050 // applicable. | 1051 // applicable. |
| 1051 if (!holder.is_identical_to(receiver)) break; | 1052 if (!holder.is_identical_to(receiver)) break; |
| 1052 return isolate()->stub_cache()->ComputeLoadNormal(); | 1053 return isolate()->stub_cache()->ComputeLoadNormal(); |
| 1053 case CALLBACKS: { | 1054 case CALLBACKS: { |
| 1054 Handle<Object> callback(lookup->GetCallbackObject()); | 1055 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); |
| 1055 if (callback->IsExecutableAccessorInfo()) { | 1056 if (callback->IsExecutableAccessorInfo()) { |
| 1056 Handle<ExecutableAccessorInfo> info = | 1057 Handle<ExecutableAccessorInfo> info = |
| 1057 Handle<ExecutableAccessorInfo>::cast(callback); | 1058 Handle<ExecutableAccessorInfo>::cast(callback); |
| 1058 if (v8::ToCData<Address>(info->getter()) == 0) break; | 1059 if (v8::ToCData<Address>(info->getter()) == 0) break; |
| 1059 if (!info->IsCompatibleReceiver(*receiver)) break; | 1060 if (!info->IsCompatibleReceiver(*receiver)) break; |
| 1060 return isolate()->stub_cache()->ComputeLoadCallback( | 1061 return isolate()->stub_cache()->ComputeLoadCallback( |
| 1061 name, receiver, holder, info); | 1062 name, receiver, holder, info); |
| 1062 } else if (callback->IsAccessorPair()) { | 1063 } else if (callback->IsAccessorPair()) { |
| 1063 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter()); | 1064 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), |
| 1065 isolate()); |
| 1064 if (!getter->IsJSFunction()) break; | 1066 if (!getter->IsJSFunction()) break; |
| 1065 if (holder->IsGlobalObject()) break; | 1067 if (holder->IsGlobalObject()) break; |
| 1066 if (!holder->HasFastProperties()) break; | 1068 if (!holder->HasFastProperties()) break; |
| 1067 return isolate()->stub_cache()->ComputeLoadViaGetter( | 1069 return isolate()->stub_cache()->ComputeLoadViaGetter( |
| 1068 name, receiver, holder, Handle<JSFunction>::cast(getter)); | 1070 name, receiver, holder, Handle<JSFunction>::cast(getter)); |
| 1069 } | 1071 } |
| 1070 // TODO(dcarney): Handle correctly. | 1072 // TODO(dcarney): Handle correctly. |
| 1071 if (callback->IsDeclaredAccessorInfo()) break; | 1073 if (callback->IsDeclaredAccessorInfo()) break; |
| 1072 ASSERT(callback->IsForeign()); | 1074 ASSERT(callback->IsForeign()); |
| 1073 // No IC support for old-style native accessors. | 1075 // No IC support for old-style native accessors. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1087 static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) { | 1089 static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) { |
| 1088 // This helper implements a few common fast cases for converting | 1090 // This helper implements a few common fast cases for converting |
| 1089 // non-smi keys of keyed loads/stores to a smi or a string. | 1091 // non-smi keys of keyed loads/stores to a smi or a string. |
| 1090 if (key->IsHeapNumber()) { | 1092 if (key->IsHeapNumber()) { |
| 1091 double value = Handle<HeapNumber>::cast(key)->value(); | 1093 double value = Handle<HeapNumber>::cast(key)->value(); |
| 1092 if (isnan(value)) { | 1094 if (isnan(value)) { |
| 1093 key = isolate->factory()->nan_symbol(); | 1095 key = isolate->factory()->nan_symbol(); |
| 1094 } else { | 1096 } else { |
| 1095 int int_value = FastD2I(value); | 1097 int int_value = FastD2I(value); |
| 1096 if (value == int_value && Smi::IsValid(int_value)) { | 1098 if (value == int_value && Smi::IsValid(int_value)) { |
| 1097 key = Handle<Smi>(Smi::FromInt(int_value)); | 1099 key = Handle<Smi>(Smi::FromInt(int_value), isolate); |
| 1098 } | 1100 } |
| 1099 } | 1101 } |
| 1100 } else if (key->IsUndefined()) { | 1102 } else if (key->IsUndefined()) { |
| 1101 key = isolate->factory()->undefined_symbol(); | 1103 key = isolate->factory()->undefined_symbol(); |
| 1102 } | 1104 } |
| 1103 return key; | 1105 return key; |
| 1104 } | 1106 } |
| 1105 | 1107 |
| 1106 | 1108 |
| 1107 static bool AddOneReceiverMapIfMissing(MapHandleList* receiver_maps, | 1109 static bool AddOneReceiverMapIfMissing(MapHandleList* receiver_maps, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1128 if (map != NULL) { | 1130 if (map != NULL) { |
| 1129 result->Add(Handle<Map>(map)); | 1131 result->Add(Handle<Map>(map)); |
| 1130 } | 1132 } |
| 1131 break; | 1133 break; |
| 1132 } | 1134 } |
| 1133 case POLYMORPHIC: { | 1135 case POLYMORPHIC: { |
| 1134 AssertNoAllocation no_allocation; | 1136 AssertNoAllocation no_allocation; |
| 1135 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 1137 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 1136 for (RelocIterator it(*stub, mask); !it.done(); it.next()) { | 1138 for (RelocIterator it(*stub, mask); !it.done(); it.next()) { |
| 1137 RelocInfo* info = it.rinfo(); | 1139 RelocInfo* info = it.rinfo(); |
| 1138 Handle<Object> object(info->target_object()); | 1140 Handle<Object> object(info->target_object(), stub->GetIsolate()); |
| 1139 ASSERT(object->IsMap()); | 1141 ASSERT(object->IsMap()); |
| 1140 AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object)); | 1142 AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object)); |
| 1141 } | 1143 } |
| 1142 break; | 1144 break; |
| 1143 } | 1145 } |
| 1144 case MEGAMORPHIC: | 1146 case MEGAMORPHIC: |
| 1145 break; | 1147 break; |
| 1146 case UNINITIALIZED: | 1148 case UNINITIALIZED: |
| 1147 case PREMONOMORPHIC: | 1149 case PREMONOMORPHIC: |
| 1148 case MONOMORPHIC_PROTOTYPE_FAILURE: | 1150 case MONOMORPHIC_PROTOTYPE_FAILURE: |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 switch (lookup->type()) { | 1278 switch (lookup->type()) { |
| 1277 case FIELD: | 1279 case FIELD: |
| 1278 return isolate()->stub_cache()->ComputeKeyedLoadField( | 1280 return isolate()->stub_cache()->ComputeKeyedLoadField( |
| 1279 name, receiver, holder, lookup->GetFieldIndex()); | 1281 name, receiver, holder, lookup->GetFieldIndex()); |
| 1280 case CONSTANT_FUNCTION: { | 1282 case CONSTANT_FUNCTION: { |
| 1281 Handle<JSFunction> constant(lookup->GetConstantFunction()); | 1283 Handle<JSFunction> constant(lookup->GetConstantFunction()); |
| 1282 return isolate()->stub_cache()->ComputeKeyedLoadConstant( | 1284 return isolate()->stub_cache()->ComputeKeyedLoadConstant( |
| 1283 name, receiver, holder, constant); | 1285 name, receiver, holder, constant); |
| 1284 } | 1286 } |
| 1285 case CALLBACKS: { | 1287 case CALLBACKS: { |
| 1286 Handle<Object> callback_object(lookup->GetCallbackObject()); | 1288 Handle<Object> callback_object(lookup->GetCallbackObject(), isolate()); |
| 1287 // TODO(dcarney): Handle DeclaredAccessorInfo correctly. | 1289 // TODO(dcarney): Handle DeclaredAccessorInfo correctly. |
| 1288 if (!callback_object->IsExecutableAccessorInfo()) break; | 1290 if (!callback_object->IsExecutableAccessorInfo()) break; |
| 1289 Handle<ExecutableAccessorInfo> callback = | 1291 Handle<ExecutableAccessorInfo> callback = |
| 1290 Handle<ExecutableAccessorInfo>::cast(callback_object); | 1292 Handle<ExecutableAccessorInfo>::cast(callback_object); |
| 1291 if (v8::ToCData<Address>(callback->getter()) == 0) break; | 1293 if (v8::ToCData<Address>(callback->getter()) == 0) break; |
| 1292 if (!callback->IsCompatibleReceiver(*receiver)) break; | 1294 if (!callback->IsCompatibleReceiver(*receiver)) break; |
| 1293 return isolate()->stub_cache()->ComputeKeyedLoadCallback( | 1295 return isolate()->stub_cache()->ComputeKeyedLoadCallback( |
| 1294 name, receiver, holder, callback); | 1296 name, receiver, holder, callback); |
| 1295 } | 1297 } |
| 1296 case INTERCEPTOR: | 1298 case INTERCEPTOR: |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 // from the property cell. So the property must be directly on the | 1472 // from the property cell. So the property must be directly on the |
| 1471 // global object. | 1473 // global object. |
| 1472 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); | 1474 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); |
| 1473 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(lookup)); | 1475 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(lookup)); |
| 1474 return isolate()->stub_cache()->ComputeStoreGlobal( | 1476 return isolate()->stub_cache()->ComputeStoreGlobal( |
| 1475 name, global, cell, strict_mode); | 1477 name, global, cell, strict_mode); |
| 1476 } | 1478 } |
| 1477 if (!holder.is_identical_to(receiver)) break; | 1479 if (!holder.is_identical_to(receiver)) break; |
| 1478 return isolate()->stub_cache()->ComputeStoreNormal(strict_mode); | 1480 return isolate()->stub_cache()->ComputeStoreNormal(strict_mode); |
| 1479 case CALLBACKS: { | 1481 case CALLBACKS: { |
| 1480 Handle<Object> callback(lookup->GetCallbackObject()); | 1482 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); |
| 1481 if (callback->IsExecutableAccessorInfo()) { | 1483 if (callback->IsExecutableAccessorInfo()) { |
| 1482 Handle<ExecutableAccessorInfo> info = | 1484 Handle<ExecutableAccessorInfo> info = |
| 1483 Handle<ExecutableAccessorInfo>::cast(callback); | 1485 Handle<ExecutableAccessorInfo>::cast(callback); |
| 1484 if (v8::ToCData<Address>(info->setter()) == 0) break; | 1486 if (v8::ToCData<Address>(info->setter()) == 0) break; |
| 1485 if (!holder->HasFastProperties()) break; | 1487 if (!holder->HasFastProperties()) break; |
| 1486 if (!info->IsCompatibleReceiver(*receiver)) break; | 1488 if (!info->IsCompatibleReceiver(*receiver)) break; |
| 1487 return isolate()->stub_cache()->ComputeStoreCallback( | 1489 return isolate()->stub_cache()->ComputeStoreCallback( |
| 1488 name, receiver, holder, info, strict_mode); | 1490 name, receiver, holder, info, strict_mode); |
| 1489 } else if (callback->IsAccessorPair()) { | 1491 } else if (callback->IsAccessorPair()) { |
| 1490 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter()); | 1492 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter(), |
| 1493 isolate()); |
| 1491 if (!setter->IsJSFunction()) break; | 1494 if (!setter->IsJSFunction()) break; |
| 1492 if (holder->IsGlobalObject()) break; | 1495 if (holder->IsGlobalObject()) break; |
| 1493 if (!holder->HasFastProperties()) break; | 1496 if (!holder->HasFastProperties()) break; |
| 1494 return isolate()->stub_cache()->ComputeStoreViaSetter( | 1497 return isolate()->stub_cache()->ComputeStoreViaSetter( |
| 1495 name, receiver, holder, Handle<JSFunction>::cast(setter), | 1498 name, receiver, holder, Handle<JSFunction>::cast(setter), |
| 1496 strict_mode); | 1499 strict_mode); |
| 1497 } | 1500 } |
| 1498 // TODO(dcarney): Handle correctly. | 1501 // TODO(dcarney): Handle correctly. |
| 1499 if (callback->IsDeclaredAccessorInfo()) break; | 1502 if (callback->IsDeclaredAccessorInfo()) break; |
| 1500 ASSERT(callback->IsForeign()); | 1503 ASSERT(callback->IsForeign()); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state(); | 1915 Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state(); |
| 1913 return ic.Store(state, | 1916 return ic.Store(state, |
| 1914 Code::GetStrictMode(extra_ic_state), | 1917 Code::GetStrictMode(extra_ic_state), |
| 1915 args.at<Object>(0), | 1918 args.at<Object>(0), |
| 1916 args.at<String>(1), | 1919 args.at<String>(1), |
| 1917 args.at<Object>(2)); | 1920 args.at<Object>(2)); |
| 1918 } | 1921 } |
| 1919 | 1922 |
| 1920 | 1923 |
| 1921 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) { | 1924 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) { |
| 1922 NoHandleAllocation nha; | 1925 NoHandleAllocation nha(isolate); |
| 1923 | 1926 |
| 1924 ASSERT(args.length() == 2); | 1927 ASSERT(args.length() == 2); |
| 1925 JSArray* receiver = JSArray::cast(args[0]); | 1928 JSArray* receiver = JSArray::cast(args[0]); |
| 1926 Object* len = args[1]; | 1929 Object* len = args[1]; |
| 1927 | 1930 |
| 1928 // The generated code should filter out non-Smis before we get here. | 1931 // The generated code should filter out non-Smis before we get here. |
| 1929 ASSERT(len->IsSmi()); | 1932 ASSERT(len->IsSmi()); |
| 1930 | 1933 |
| 1931 #ifdef DEBUG | 1934 #ifdef DEBUG |
| 1932 // The length property has to be a writable callback property. | 1935 // The length property has to be a writable callback property. |
| 1933 LookupResult debug_lookup(isolate); | 1936 LookupResult debug_lookup(isolate); |
| 1934 receiver->LocalLookup(isolate->heap()->length_symbol(), &debug_lookup); | 1937 receiver->LocalLookup(isolate->heap()->length_symbol(), &debug_lookup); |
| 1935 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly()); | 1938 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly()); |
| 1936 #endif | 1939 #endif |
| 1937 | 1940 |
| 1938 Object* result; | 1941 Object* result; |
| 1939 MaybeObject* maybe_result = receiver->SetElementsLength(len); | 1942 MaybeObject* maybe_result = receiver->SetElementsLength(len); |
| 1940 if (!maybe_result->To(&result)) return maybe_result; | 1943 if (!maybe_result->To(&result)) return maybe_result; |
| 1941 | 1944 |
| 1942 return len; | 1945 return len; |
| 1943 } | 1946 } |
| 1944 | 1947 |
| 1945 | 1948 |
| 1946 // Extend storage is called in a store inline cache when | 1949 // Extend storage is called in a store inline cache when |
| 1947 // it is necessary to extend the properties array of a | 1950 // it is necessary to extend the properties array of a |
| 1948 // JSObject. | 1951 // JSObject. |
| 1949 RUNTIME_FUNCTION(MaybeObject*, SharedStoreIC_ExtendStorage) { | 1952 RUNTIME_FUNCTION(MaybeObject*, SharedStoreIC_ExtendStorage) { |
| 1950 NoHandleAllocation na; | 1953 NoHandleAllocation na(isolate); |
| 1951 ASSERT(args.length() == 3); | 1954 ASSERT(args.length() == 3); |
| 1952 | 1955 |
| 1953 // Convert the parameters | 1956 // Convert the parameters |
| 1954 JSObject* object = JSObject::cast(args[0]); | 1957 JSObject* object = JSObject::cast(args[0]); |
| 1955 Map* transition = Map::cast(args[1]); | 1958 Map* transition = Map::cast(args[1]); |
| 1956 Object* value = args[2]; | 1959 Object* value = args[2]; |
| 1957 | 1960 |
| 1958 // Check the object has run out out property space. | 1961 // Check the object has run out out property space. |
| 1959 ASSERT(object->HasFastProperties()); | 1962 ASSERT(object->HasFastProperties()); |
| 1960 ASSERT(object->map()->unused_property_fields() == 0); | 1963 ASSERT(object->map()->unused_property_fields() == 0); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1989 return ic.Store(state, | 1992 return ic.Store(state, |
| 1990 Code::GetStrictMode(extra_ic_state), | 1993 Code::GetStrictMode(extra_ic_state), |
| 1991 args.at<Object>(0), | 1994 args.at<Object>(0), |
| 1992 args.at<Object>(1), | 1995 args.at<Object>(1), |
| 1993 args.at<Object>(2), | 1996 args.at<Object>(2), |
| 1994 MISS); | 1997 MISS); |
| 1995 } | 1998 } |
| 1996 | 1999 |
| 1997 | 2000 |
| 1998 RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Slow) { | 2001 RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Slow) { |
| 1999 NoHandleAllocation na; | 2002 NoHandleAllocation na(isolate); |
| 2000 ASSERT(args.length() == 3); | 2003 ASSERT(args.length() == 3); |
| 2001 KeyedStoreIC ic(isolate); | 2004 KeyedStoreIC ic(isolate); |
| 2002 Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state(); | 2005 Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state(); |
| 2003 Handle<Object> object = args.at<Object>(0); | 2006 Handle<Object> object = args.at<Object>(0); |
| 2004 Handle<Object> key = args.at<Object>(1); | 2007 Handle<Object> key = args.at<Object>(1); |
| 2005 Handle<Object> value = args.at<Object>(2); | 2008 Handle<Object> value = args.at<Object>(2); |
| 2006 StrictModeFlag strict_mode = Code::GetStrictMode(extra_ic_state); | 2009 StrictModeFlag strict_mode = Code::GetStrictMode(extra_ic_state); |
| 2007 return Runtime::SetObjectProperty(isolate, | 2010 return Runtime::SetObjectProperty(isolate, |
| 2008 object, | 2011 object, |
| 2009 key, | 2012 key, |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2511 | 2514 |
| 2512 // Activate inlined smi code. | 2515 // Activate inlined smi code. |
| 2513 if (previous_state == UNINITIALIZED) { | 2516 if (previous_state == UNINITIALIZED) { |
| 2514 PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK); | 2517 PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK); |
| 2515 } | 2518 } |
| 2516 } | 2519 } |
| 2517 | 2520 |
| 2518 | 2521 |
| 2519 // Used from ICCompareStub::GenerateMiss in code-stubs-<arch>.cc. | 2522 // Used from ICCompareStub::GenerateMiss in code-stubs-<arch>.cc. |
| 2520 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { | 2523 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { |
| 2521 NoHandleAllocation na; | 2524 NoHandleAllocation na(isolate); |
| 2522 ASSERT(args.length() == 3); | 2525 ASSERT(args.length() == 3); |
| 2523 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); | 2526 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); |
| 2524 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); | 2527 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); |
| 2525 return ic.target(); | 2528 return ic.target(); |
| 2526 } | 2529 } |
| 2527 | 2530 |
| 2528 | 2531 |
| 2529 RUNTIME_FUNCTION(MaybeObject*, ToBoolean_Patch) { | 2532 RUNTIME_FUNCTION(MaybeObject*, ToBoolean_Patch) { |
| 2530 ASSERT(args.length() == 3); | 2533 ASSERT(args.length() == 3); |
| 2531 | 2534 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2558 #undef ADDR | 2561 #undef ADDR |
| 2559 }; | 2562 }; |
| 2560 | 2563 |
| 2561 | 2564 |
| 2562 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2565 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2563 return IC_utilities[id]; | 2566 return IC_utilities[id]; |
| 2564 } | 2567 } |
| 2565 | 2568 |
| 2566 | 2569 |
| 2567 } } // namespace v8::internal | 2570 } } // namespace v8::internal |
| OLD | NEW |