| 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 Isolate* isolate = cell->GetIsolate(); | 556 Isolate* isolate = cell->GetIsolate(); |
| 557 Handle<Type> union_type(PropertyCell::UpdateType(cell, value), isolate); | 557 Handle<Type> union_type(PropertyCell::UpdateType(cell, value), isolate); |
| 558 bool is_constant = union_type->IsConstant(); | 558 bool is_constant = union_type->IsConstant(); |
| 559 StoreGlobalStub stub(strict_mode, is_constant); | 559 StoreGlobalStub stub(strict_mode, is_constant); |
| 560 | 560 |
| 561 Handle<Code> code = FindIC( | 561 Handle<Code> code = FindIC( |
| 562 name, Handle<JSObject>::cast(receiver), | 562 name, Handle<JSObject>::cast(receiver), |
| 563 Code::STORE_IC, Code::NORMAL, stub.GetExtraICState()); | 563 Code::STORE_IC, Code::NORMAL, stub.GetExtraICState()); |
| 564 if (!code.is_null()) return code; | 564 if (!code.is_null()) return code; |
| 565 | 565 |
| 566 if (is_constant) return stub.GetCode(isolate_); | |
| 567 | |
| 568 // Replace the placeholder cell and global object map with the actual global | 566 // Replace the placeholder cell and global object map with the actual global |
| 569 // cell and receiver map. | 567 // cell and receiver map. |
| 570 Handle<Map> cell_map(isolate_->heap()->global_property_cell_map()); | |
| 571 Handle<Map> meta_map(isolate_->heap()->meta_map()); | 568 Handle<Map> meta_map(isolate_->heap()->meta_map()); |
| 572 Handle<Object> receiver_map(receiver->map(), isolate_); | 569 Handle<Object> receiver_map(receiver->map(), isolate_); |
| 573 code = stub.GetCodeCopyFromTemplate(isolate_); | 570 code = stub.GetCodeCopyFromTemplate(isolate_); |
| 574 code->ReplaceNthObject(1, *meta_map, *receiver_map); | 571 code->ReplaceNthObject(1, *meta_map, *receiver_map); |
| 572 Handle<Map> cell_map(isolate_->heap()->global_property_cell_map()); |
| 575 code->ReplaceNthObject(1, *cell_map, *cell); | 573 code->ReplaceNthObject(1, *cell_map, *cell); |
| 574 |
| 576 JSObject::UpdateMapCodeCache(receiver, name, code); | 575 JSObject::UpdateMapCodeCache(receiver, name, code); |
| 577 | 576 |
| 578 return code; | 577 return code; |
| 579 } | 578 } |
| 580 | 579 |
| 581 | 580 |
| 582 Handle<Code> StubCache::ComputeStoreCallback( | 581 Handle<Code> StubCache::ComputeStoreCallback( |
| 583 Handle<Name> name, | 582 Handle<Name> name, |
| 584 Handle<JSObject> receiver, | 583 Handle<JSObject> receiver, |
| 585 Handle<JSObject> holder, | 584 Handle<JSObject> holder, |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 if (FLAG_print_code_stubs) code->Disassemble(name); | 1531 if (FLAG_print_code_stubs) code->Disassemble(name); |
| 1533 #endif | 1532 #endif |
| 1534 return code; | 1533 return code; |
| 1535 } | 1534 } |
| 1536 | 1535 |
| 1537 | 1536 |
| 1538 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags, | 1537 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags, |
| 1539 Handle<Name> name) { | 1538 Handle<Name> name) { |
| 1540 return (FLAG_print_code_stubs && !name.is_null() && name->IsString()) | 1539 return (FLAG_print_code_stubs && !name.is_null() && name->IsString()) |
| 1541 ? GetCodeWithFlags(flags, *Handle<String>::cast(name)->ToCString()) | 1540 ? GetCodeWithFlags(flags, *Handle<String>::cast(name)->ToCString()) |
| 1542 : GetCodeWithFlags(flags, reinterpret_cast<char*>(NULL)); | 1541 : GetCodeWithFlags(flags, NULL); |
| 1543 } | 1542 } |
| 1544 | 1543 |
| 1545 | 1544 |
| 1546 void StubCompiler::LookupPostInterceptor(Handle<JSObject> holder, | 1545 void StubCompiler::LookupPostInterceptor(Handle<JSObject> holder, |
| 1547 Handle<Name> name, | 1546 Handle<Name> name, |
| 1548 LookupResult* lookup) { | 1547 LookupResult* lookup) { |
| 1549 holder->LocalLookupRealNamedProperty(*name, lookup); | 1548 holder->LocalLookupRealNamedProperty(*name, lookup); |
| 1550 if (lookup->IsFound()) return; | 1549 if (lookup->IsFound()) return; |
| 1551 if (holder->GetPrototype()->IsNull()) return; | 1550 if (holder->GetPrototype()->IsNull()) return; |
| 1552 holder->GetPrototype()->Lookup(*name, lookup); | 1551 holder->GetPrototype()->Lookup(*name, lookup); |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1986 receiver_map->FindTransitionedMap(receiver_maps); | 1985 receiver_map->FindTransitionedMap(receiver_maps); |
| 1987 | 1986 |
| 1988 // TODO(mvstanton): The code below is doing pessimistic elements | 1987 // TODO(mvstanton): The code below is doing pessimistic elements |
| 1989 // transitions. I would like to stop doing that and rely on Allocation Site | 1988 // transitions. I would like to stop doing that and rely on Allocation Site |
| 1990 // Tracking to do a better job of ensuring the data types are what they need | 1989 // Tracking to do a better job of ensuring the data types are what they need |
| 1991 // to be. Not all the elements are in place yet, pessimistic elements | 1990 // to be. Not all the elements are in place yet, pessimistic elements |
| 1992 // transitions are still important for performance. | 1991 // transitions are still important for performance. |
| 1993 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 1992 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 1994 ElementsKind elements_kind = receiver_map->elements_kind(); | 1993 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 1995 if (!transitioned_map.is_null()) { | 1994 if (!transitioned_map.is_null()) { |
| 1996 cached_stub = ElementsTransitionAndStoreStub( | 1995 if (FLAG_compiled_transitions) { |
| 1997 elements_kind, | 1996 cached_stub = ElementsTransitionAndStoreStub( |
| 1998 transitioned_map->elements_kind(), | 1997 elements_kind, |
| 1999 is_js_array, | 1998 transitioned_map->elements_kind(), |
| 2000 strict_mode(), | 1999 is_js_array, |
| 2001 store_mode_).GetCode(isolate()); | 2000 store_mode_).GetCode(isolate()); |
| 2001 } else { |
| 2002 // TODO(bmeurer) Remove this when compiled transitions is enabled |
| 2003 cached_stub = ElementsTransitionAndStorePlatformStub( |
| 2004 elements_kind, |
| 2005 transitioned_map->elements_kind(), |
| 2006 is_js_array, |
| 2007 strict_mode(), |
| 2008 store_mode_).GetCode(isolate()); |
| 2009 } |
| 2002 } else { | 2010 } else { |
| 2003 if (FLAG_compiled_keyed_stores && | 2011 if (FLAG_compiled_keyed_stores && |
| 2004 (receiver_map->has_fast_elements() || | 2012 (receiver_map->has_fast_elements() || |
| 2005 receiver_map->has_external_array_elements())) { | 2013 receiver_map->has_external_array_elements())) { |
| 2006 cached_stub = KeyedStoreFastElementStub( | 2014 cached_stub = KeyedStoreFastElementStub( |
| 2007 is_js_array, | 2015 is_js_array, |
| 2008 elements_kind, | 2016 elements_kind, |
| 2009 store_mode_).GetCode(isolate()); | 2017 store_mode_).GetCode(isolate()); |
| 2010 } else { | 2018 } else { |
| 2011 cached_stub = KeyedStoreElementStub( | 2019 cached_stub = KeyedStoreElementStub( |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2193 Handle<FunctionTemplateInfo>( | 2201 Handle<FunctionTemplateInfo>( |
| 2194 FunctionTemplateInfo::cast(signature->receiver())); | 2202 FunctionTemplateInfo::cast(signature->receiver())); |
| 2195 } | 2203 } |
| 2196 } | 2204 } |
| 2197 | 2205 |
| 2198 is_simple_api_call_ = true; | 2206 is_simple_api_call_ = true; |
| 2199 } | 2207 } |
| 2200 | 2208 |
| 2201 | 2209 |
| 2202 } } // namespace v8::internal | 2210 } } // namespace v8::internal |
| OLD | NEW |