OLD | NEW |
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 Handle<JSObject> holder(lookup->holder()); | 1397 Handle<JSObject> holder(lookup->holder()); |
1398 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder); | 1398 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder); |
1399 | 1399 |
1400 if (lookup->IsTransition()) { | 1400 if (lookup->IsTransition()) { |
1401 // Explicitly pass in the receiver map since LookupForWrite may have | 1401 // Explicitly pass in the receiver map since LookupForWrite may have |
1402 // stored something else than the receiver in the holder. | 1402 // stored something else than the receiver in the holder. |
1403 Handle<Map> transition(lookup->GetTransitionTarget()); | 1403 Handle<Map> transition(lookup->GetTransitionTarget()); |
1404 PropertyDetails details = lookup->GetPropertyDetails(); | 1404 PropertyDetails details = lookup->GetPropertyDetails(); |
1405 | 1405 |
1406 if (details.type() != CALLBACKS && details.attributes() == NONE) { | 1406 if (details.type() != CALLBACKS && details.attributes() == NONE) { |
1407 return compiler.CompileStoreTransition(lookup, transition, name); | 1407 return compiler.CompileStoreTransition(transition, name); |
1408 } | 1408 } |
1409 } else { | 1409 } else { |
1410 switch (lookup->type()) { | 1410 switch (lookup->type()) { |
1411 case FIELD: | 1411 case FIELD: |
1412 return compiler.CompileStoreField(lookup, name); | 1412 return compiler.CompileStoreField(lookup, name); |
1413 case NORMAL: | 1413 case NORMAL: |
1414 if (kind() == Code::KEYED_STORE_IC) break; | 1414 if (kind() == Code::KEYED_STORE_IC) break; |
1415 if (receiver->IsJSGlobalProxy() || receiver->IsGlobalObject()) { | 1415 if (receiver->IsJSGlobalProxy() || receiver->IsGlobalObject()) { |
1416 // The stub generated for the global object picks the value directly | 1416 // The stub generated for the global object picks the value directly |
1417 // from the property cell. So the property must be directly on the | 1417 // from the property cell. So the property must be directly on the |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 ic.UpdateState(receiver, key); | 2029 ic.UpdateState(receiver, key); |
2030 Handle<Object> result; | 2030 Handle<Object> result; |
2031 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 2031 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
2032 isolate, | 2032 isolate, |
2033 result, | 2033 result, |
2034 ic.Store(receiver, key, args.at<Object>(2))); | 2034 ic.Store(receiver, key, args.at<Object>(2))); |
2035 return *result; | 2035 return *result; |
2036 } | 2036 } |
2037 | 2037 |
2038 | 2038 |
2039 RUNTIME_FUNCTION(StoreIC_ArrayLength) { | |
2040 TimerEventScope<TimerEventIcMiss> timer(isolate); | |
2041 HandleScope scope(isolate); | |
2042 | |
2043 ASSERT(args.length() == 2); | |
2044 Handle<JSArray> receiver = args.at<JSArray>(0); | |
2045 Handle<Object> len = args.at<Object>(1); | |
2046 | |
2047 // The generated code should filter out non-Smis before we get here. | |
2048 ASSERT(len->IsSmi()); | |
2049 | |
2050 #ifdef DEBUG | |
2051 // The length property has to be a writable callback property. | |
2052 LookupResult debug_lookup(isolate); | |
2053 receiver->LookupOwn(isolate->factory()->length_string(), &debug_lookup); | |
2054 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly()); | |
2055 #endif | |
2056 | |
2057 RETURN_FAILURE_ON_EXCEPTION( | |
2058 isolate, JSArray::SetElementsLength(receiver, len)); | |
2059 return *len; | |
2060 } | |
2061 | |
2062 | |
2063 // Extend storage is called in a store inline cache when | 2039 // Extend storage is called in a store inline cache when |
2064 // it is necessary to extend the properties array of a | 2040 // it is necessary to extend the properties array of a |
2065 // JSObject. | 2041 // JSObject. |
2066 RUNTIME_FUNCTION(SharedStoreIC_ExtendStorage) { | 2042 RUNTIME_FUNCTION(SharedStoreIC_ExtendStorage) { |
2067 TimerEventScope<TimerEventIcMiss> timer(isolate); | 2043 TimerEventScope<TimerEventIcMiss> timer(isolate); |
2068 HandleScope shs(isolate); | 2044 HandleScope shs(isolate); |
2069 ASSERT(args.length() == 3); | 2045 ASSERT(args.length() == 3); |
2070 | 2046 |
2071 // Convert the parameters | 2047 // Convert the parameters |
2072 Handle<JSObject> object = args.at<JSObject>(0); | 2048 Handle<JSObject> object = args.at<JSObject>(0); |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3053 #undef ADDR | 3029 #undef ADDR |
3054 }; | 3030 }; |
3055 | 3031 |
3056 | 3032 |
3057 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3033 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3058 return IC_utilities[id]; | 3034 return IC_utilities[id]; |
3059 } | 3035 } |
3060 | 3036 |
3061 | 3037 |
3062 } } // namespace v8::internal | 3038 } } // namespace v8::internal |
OLD | NEW |