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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 Handle<JSObject> receiver) { | 236 Handle<JSObject> receiver) { |
237 // If no global objects are present in the prototype chain, the load | 237 // If no global objects are present in the prototype chain, the load |
238 // nonexistent IC stub can be shared for all names for a given map | 238 // nonexistent IC stub can be shared for all names for a given map |
239 // and we use the empty string for the map cache in that case. If | 239 // and we use the empty string for the map cache in that case. If |
240 // there are global objects involved, we need to check global | 240 // there are global objects involved, we need to check global |
241 // property cells in the stub and therefore the stub will be | 241 // property cells in the stub and therefore the stub will be |
242 // specific to the name. | 242 // specific to the name. |
243 Handle<Name> cache_name = factory()->empty_string(); | 243 Handle<Name> cache_name = factory()->empty_string(); |
244 Handle<JSObject> current; | 244 Handle<JSObject> current; |
245 Handle<Object> next = receiver; | 245 Handle<Object> next = receiver; |
246 Handle<GlobalObject> global; | 246 Handle<JSGlobalObject> global; |
247 do { | 247 do { |
248 current = Handle<JSObject>::cast(next); | 248 current = Handle<JSObject>::cast(next); |
249 next = Handle<Object>(current->GetPrototype(), isolate_); | 249 next = Handle<Object>(current->GetPrototype(), isolate_); |
250 if (current->IsGlobalObject()) { | 250 if (current->IsJSGlobalObject()) { |
251 global = Handle<GlobalObject>::cast(current); | 251 global = Handle<JSGlobalObject>::cast(current); |
252 cache_name = name; | 252 cache_name = name; |
253 } else if (!current->HasFastProperties()) { | 253 } else if (!current->HasFastProperties()) { |
254 cache_name = name; | 254 cache_name = name; |
255 } | 255 } |
256 } while (!next->IsNull()); | 256 } while (!next->IsNull()); |
257 | 257 |
258 // Compile the stub that is either shared for all names or | 258 // Compile the stub that is either shared for all names or |
259 // name specific if there are global objects involved. | 259 // name specific if there are global objects involved. |
260 Handle<Code> handler = FindLoadHandler( | 260 Handle<Code> handler = FindLoadHandler( |
261 cache_name, receiver, receiver, Code::LOAD_IC, Code::NONEXISTENT); | 261 cache_name, receiver, receiver, Code::LOAD_IC, Code::NONEXISTENT); |
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 Label* success) { | 1632 Label* success) { |
1633 Label miss; | 1633 Label miss; |
1634 | 1634 |
1635 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); | 1635 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); |
1636 | 1636 |
1637 HandlerFrontendFooter(name, success, &miss); | 1637 HandlerFrontendFooter(name, success, &miss); |
1638 return reg; | 1638 return reg; |
1639 } | 1639 } |
1640 | 1640 |
1641 | 1641 |
| 1642 void BaseLoadStubCompiler::NonexistentHandlerFrontend( |
| 1643 Handle<JSObject> object, |
| 1644 Handle<JSObject> last, |
| 1645 Handle<Name> name, |
| 1646 Label* success, |
| 1647 Handle<JSGlobalObject> global) { |
| 1648 Label miss; |
| 1649 |
| 1650 Register holder = |
| 1651 HandlerFrontendHeader(object, receiver(), last, name, &miss); |
| 1652 |
| 1653 if (!last->HasFastProperties() && |
| 1654 !last->IsJSGlobalObject() && |
| 1655 !last->IsJSGlobalProxy()) { |
| 1656 if (!name->IsUniqueName()) { |
| 1657 ASSERT(name->IsString()); |
| 1658 name = factory()->InternalizeString(Handle<String>::cast(name)); |
| 1659 } |
| 1660 ASSERT(last->property_dictionary()->FindEntry(*name) == |
| 1661 NameDictionary::kNotFound); |
| 1662 GenerateDictionaryNegativeLookup(masm(), &miss, holder, name, |
| 1663 scratch2(), scratch3()); |
| 1664 } |
| 1665 |
| 1666 // If the last object in the prototype chain is a global object, |
| 1667 // check that the global property cell is empty. |
| 1668 if (!global.is_null()) { |
| 1669 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss); |
| 1670 } |
| 1671 |
| 1672 HandlerFrontendFooter(name, success, &miss); |
| 1673 } |
| 1674 |
| 1675 |
1642 Handle<Code> BaseLoadStubCompiler::CompileLoadField( | 1676 Handle<Code> BaseLoadStubCompiler::CompileLoadField( |
1643 Handle<JSObject> object, | 1677 Handle<JSObject> object, |
1644 Handle<JSObject> holder, | 1678 Handle<JSObject> holder, |
1645 Handle<Name> name, | 1679 Handle<Name> name, |
1646 PropertyIndex field, | 1680 PropertyIndex field, |
1647 Representation representation) { | 1681 Representation representation) { |
1648 Label miss; | 1682 Label miss; |
1649 | 1683 |
1650 Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss); | 1684 Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss); |
1651 | 1685 |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 Handle<FunctionTemplateInfo>( | 2286 Handle<FunctionTemplateInfo>( |
2253 FunctionTemplateInfo::cast(signature->receiver())); | 2287 FunctionTemplateInfo::cast(signature->receiver())); |
2254 } | 2288 } |
2255 } | 2289 } |
2256 | 2290 |
2257 is_simple_api_call_ = true; | 2291 is_simple_api_call_ = true; |
2258 } | 2292 } |
2259 | 2293 |
2260 | 2294 |
2261 } } // namespace v8::internal | 2295 } } // namespace v8::internal |
OLD | NEW |