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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 StoreGlobalStub stub( | 1550 StoreGlobalStub stub( |
1551 isolate(), union_type->IsConstant(), receiver->IsJSGlobalProxy()); | 1551 isolate(), union_type->IsConstant(), receiver->IsJSGlobalProxy()); |
1552 Handle<Code> code = stub.GetCodeCopyFromTemplate(global, cell); | 1552 Handle<Code> code = stub.GetCodeCopyFromTemplate(global, cell); |
1553 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. | 1553 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. |
1554 HeapObject::UpdateMapCodeCache(receiver, name, code); | 1554 HeapObject::UpdateMapCodeCache(receiver, name, code); |
1555 return code; | 1555 return code; |
1556 } | 1556 } |
1557 DCHECK(holder.is_identical_to(receiver)); | 1557 DCHECK(holder.is_identical_to(receiver)); |
1558 return isolate()->builtins()->StoreIC_Normal(); | 1558 return isolate()->builtins()->StoreIC_Normal(); |
1559 case CALLBACKS: { | 1559 case CALLBACKS: { |
1560 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); | 1560 if (!holder->HasFastProperties()) break; |
| 1561 Handle<Object> callback(lookup->GetValueFromMap(holder->map()), |
| 1562 isolate()); |
1561 if (callback->IsExecutableAccessorInfo()) { | 1563 if (callback->IsExecutableAccessorInfo()) { |
1562 Handle<ExecutableAccessorInfo> info = | 1564 Handle<ExecutableAccessorInfo> info = |
1563 Handle<ExecutableAccessorInfo>::cast(callback); | 1565 Handle<ExecutableAccessorInfo>::cast(callback); |
1564 if (v8::ToCData<Address>(info->setter()) == 0) break; | 1566 if (v8::ToCData<Address>(info->setter()) == 0) break; |
1565 if (!holder->HasFastProperties()) break; | |
1566 if (!ExecutableAccessorInfo::IsCompatibleReceiverType( | 1567 if (!ExecutableAccessorInfo::IsCompatibleReceiverType( |
1567 isolate(), info, receiver_type())) { | 1568 isolate(), info, receiver_type())) { |
1568 break; | 1569 break; |
1569 } | 1570 } |
1570 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), | 1571 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), |
1571 holder); | 1572 holder); |
1572 return compiler.CompileStoreCallback(receiver, name, info); | 1573 return compiler.CompileStoreCallback(receiver, name, info); |
1573 } else if (callback->IsAccessorPair()) { | 1574 } else if (callback->IsAccessorPair()) { |
1574 Handle<Object> setter( | 1575 Handle<Object> setter( |
1575 Handle<AccessorPair>::cast(callback)->setter(), isolate()); | 1576 Handle<AccessorPair>::cast(callback)->setter(), isolate()); |
1576 if (!setter->IsJSFunction()) break; | 1577 if (!setter->IsJSFunction()) break; |
1577 if (holder->IsGlobalObject()) break; | |
1578 if (!holder->HasFastProperties()) break; | |
1579 Handle<JSFunction> function = Handle<JSFunction>::cast(setter); | 1578 Handle<JSFunction> function = Handle<JSFunction>::cast(setter); |
1580 CallOptimization call_optimization(function); | 1579 CallOptimization call_optimization(function); |
1581 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), | 1580 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), |
1582 holder); | 1581 holder); |
1583 if (call_optimization.is_simple_api_call() && | 1582 if (call_optimization.is_simple_api_call() && |
1584 call_optimization.IsCompatibleReceiver(receiver, holder)) { | 1583 call_optimization.IsCompatibleReceiver(receiver, holder)) { |
1585 return compiler.CompileStoreCallback(receiver, name, | 1584 return compiler.CompileStoreCallback(receiver, name, |
1586 call_optimization); | 1585 call_optimization); |
1587 } | 1586 } |
1588 return compiler.CompileStoreViaSetter( | 1587 return compiler.CompileStoreViaSetter( |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3175 #undef ADDR | 3174 #undef ADDR |
3176 }; | 3175 }; |
3177 | 3176 |
3178 | 3177 |
3179 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3178 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3180 return IC_utilities[id]; | 3179 return IC_utilities[id]; |
3181 } | 3180 } |
3182 | 3181 |
3183 | 3182 |
3184 } } // namespace v8::internal | 3183 } } // namespace v8::internal |
OLD | NEW |