OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2006 ASSERT(var != NULL); | 2006 ASSERT(var != NULL); |
2007 ASSERT(var->is_global() || var->AsSlot() != NULL); | 2007 ASSERT(var->is_global() || var->AsSlot() != NULL); |
2008 | 2008 |
2009 if (var->is_global()) { | 2009 if (var->is_global()) { |
2010 ASSERT(!var->is_this()); | 2010 ASSERT(!var->is_this()); |
2011 // Assignment to a global variable. Use inline caching for the | 2011 // Assignment to a global variable. Use inline caching for the |
2012 // assignment. Right-hand-side value is passed in eax, variable name in | 2012 // assignment. Right-hand-side value is passed in eax, variable name in |
2013 // ecx, and the global object on the stack. | 2013 // ecx, and the global object on the stack. |
2014 __ mov(ecx, var->name()); | 2014 __ mov(ecx, var->name()); |
2015 __ mov(edx, GlobalObjectOperand()); | 2015 __ mov(edx, GlobalObjectOperand()); |
2016 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 2016 Handle<Code> ic(Builtins::builtin( |
2017 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 2017 is_strict() ? Builtins::StoreIC_Initialize_Strict |
| 2018 : Builtins::StoreIC_Initialize)); |
| 2019 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); |
2018 | 2020 |
2019 } else if (op == Token::INIT_CONST) { | 2021 } else if (op == Token::INIT_CONST) { |
2020 // Like var declarations, const declarations are hoisted to function | 2022 // Like var declarations, const declarations are hoisted to function |
2021 // scope. However, unlike var initializers, const initializers are able | 2023 // scope. However, unlike var initializers, const initializers are able |
2022 // to drill a hole to that function context, even from inside a 'with' | 2024 // to drill a hole to that function context, even from inside a 'with' |
2023 // context. We thus bypass the normal static scope lookup. | 2025 // context. We thus bypass the normal static scope lookup. |
2024 Slot* slot = var->AsSlot(); | 2026 Slot* slot = var->AsSlot(); |
2025 Label skip; | 2027 Label skip; |
2026 switch (slot->type()) { | 2028 switch (slot->type()) { |
2027 case Slot::PARAMETER: | 2029 case Slot::PARAMETER: |
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4401 // And return. | 4403 // And return. |
4402 __ ret(0); | 4404 __ ret(0); |
4403 } | 4405 } |
4404 | 4406 |
4405 | 4407 |
4406 #undef __ | 4408 #undef __ |
4407 | 4409 |
4408 } } // namespace v8::internal | 4410 } } // namespace v8::internal |
4409 | 4411 |
4410 #endif // V8_TARGET_ARCH_IA32 | 4412 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |