| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 Handle<JSObject> receiver) { | 238 Handle<JSObject> receiver) { |
| 239 // If no global objects are present in the prototype chain, the load | 239 // If no global objects are present in the prototype chain, the load |
| 240 // nonexistent IC stub can be shared for all names for a given map | 240 // nonexistent IC stub can be shared for all names for a given map |
| 241 // and we use the empty string for the map cache in that case. If | 241 // and we use the empty string for the map cache in that case. If |
| 242 // there are global objects involved, we need to check global | 242 // there are global objects involved, we need to check global |
| 243 // property cells in the stub and therefore the stub will be | 243 // property cells in the stub and therefore the stub will be |
| 244 // specific to the name. | 244 // specific to the name. |
| 245 Handle<Name> cache_name = factory()->empty_string(); | 245 Handle<Name> cache_name = factory()->empty_string(); |
| 246 Handle<JSObject> current; | 246 Handle<JSObject> current; |
| 247 Handle<Object> next = receiver; | 247 Handle<Object> next = receiver; |
| 248 Handle<GlobalObject> global; | 248 Handle<JSGlobalObject> global; |
| 249 do { | 249 do { |
| 250 current = Handle<JSObject>::cast(next); | 250 current = Handle<JSObject>::cast(next); |
| 251 next = Handle<Object>(current->GetPrototype(), isolate_); | 251 next = Handle<Object>(current->GetPrototype(), isolate_); |
| 252 if (current->IsGlobalObject()) { | 252 if (current->IsJSGlobalObject()) { |
| 253 global = Handle<GlobalObject>::cast(current); | 253 global = Handle<JSGlobalObject>::cast(current); |
| 254 cache_name = name; | 254 cache_name = name; |
| 255 } else if (!current->HasFastProperties()) { | 255 } else if (!current->HasFastProperties()) { |
| 256 cache_name = name; | 256 cache_name = name; |
| 257 } | 257 } |
| 258 } while (!next->IsNull()); | 258 } while (!next->IsNull()); |
| 259 | 259 |
| 260 // Compile the stub that is either shared for all names or | 260 // Compile the stub that is either shared for all names or |
| 261 // name specific if there are global objects involved. | 261 // name specific if there are global objects involved. |
| 262 Handle<Code> handler = FindLoadHandler( | 262 Handle<Code> handler = FindLoadHandler( |
| 263 cache_name, receiver, receiver, Code::LOAD_IC, Code::NONEXISTENT); | 263 cache_name, receiver, receiver, Code::LOAD_IC, Code::NONEXISTENT); |
| (...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 Label* success) { | 1588 Label* success) { |
| 1589 Label miss; | 1589 Label miss; |
| 1590 | 1590 |
| 1591 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); | 1591 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); |
| 1592 | 1592 |
| 1593 HandlerFrontendFooter(name, success, &miss); | 1593 HandlerFrontendFooter(name, success, &miss); |
| 1594 return reg; | 1594 return reg; |
| 1595 } | 1595 } |
| 1596 | 1596 |
| 1597 | 1597 |
| 1598 void BaseLoadStubCompiler::NonexistentHandlerFrontend( |
| 1599 Handle<JSObject> object, |
| 1600 Handle<JSObject> last, |
| 1601 Handle<Name> name, |
| 1602 Label* success, |
| 1603 Handle<JSGlobalObject> global) { |
| 1604 Label miss; |
| 1605 |
| 1606 Register holder = |
| 1607 HandlerFrontendHeader(object, receiver(), last, name, &miss); |
| 1608 |
| 1609 if (!last->HasFastProperties() && |
| 1610 !last->IsJSGlobalObject() && |
| 1611 !last->IsJSGlobalProxy()) { |
| 1612 if (!name->IsUniqueName()) { |
| 1613 ASSERT(name->IsString()); |
| 1614 name = factory()->InternalizeString(Handle<String>::cast(name)); |
| 1615 } |
| 1616 ASSERT(last->property_dictionary()->FindEntry(*name) == |
| 1617 NameDictionary::kNotFound); |
| 1618 GenerateDictionaryNegativeLookup(masm(), &miss, holder, name, |
| 1619 scratch2(), scratch3()); |
| 1620 } |
| 1621 |
| 1622 // If the last object in the prototype chain is a global object, |
| 1623 // check that the global property cell is empty. |
| 1624 if (!global.is_null()) { |
| 1625 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss); |
| 1626 } |
| 1627 |
| 1628 HandlerFrontendFooter(name, success, &miss); |
| 1629 } |
| 1630 |
| 1631 |
| 1598 Handle<Code> BaseLoadStubCompiler::CompileLoadField( | 1632 Handle<Code> BaseLoadStubCompiler::CompileLoadField( |
| 1599 Handle<JSObject> object, | 1633 Handle<JSObject> object, |
| 1600 Handle<JSObject> holder, | 1634 Handle<JSObject> holder, |
| 1601 Handle<Name> name, | 1635 Handle<Name> name, |
| 1602 PropertyIndex field, | 1636 PropertyIndex field, |
| 1603 Representation representation) { | 1637 Representation representation) { |
| 1604 Label miss; | 1638 Label miss; |
| 1605 | 1639 |
| 1606 Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss); | 1640 Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss); |
| 1607 | 1641 |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 Handle<FunctionTemplateInfo>( | 2225 Handle<FunctionTemplateInfo>( |
| 2192 FunctionTemplateInfo::cast(signature->receiver())); | 2226 FunctionTemplateInfo::cast(signature->receiver())); |
| 2193 } | 2227 } |
| 2194 } | 2228 } |
| 2195 | 2229 |
| 2196 is_simple_api_call_ = true; | 2230 is_simple_api_call_ = true; |
| 2197 } | 2231 } |
| 2198 | 2232 |
| 2199 | 2233 |
| 2200 } } // namespace v8::internal | 2234 } } // namespace v8::internal |
| OLD | NEW |