Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 8965038: Clean up handling of global cell stores in the optimizing compiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 2021
2022 __ Move(rcx, instr->name()); 2022 __ Move(rcx, instr->name());
2023 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : 2023 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET :
2024 RelocInfo::CODE_TARGET_CONTEXT; 2024 RelocInfo::CODE_TARGET_CONTEXT;
2025 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 2025 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2026 CallCode(ic, mode, instr); 2026 CallCode(ic, mode, instr);
2027 } 2027 }
2028 2028
2029 2029
2030 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { 2030 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2031 Register object = ToRegister(instr->TempAt(0)); 2031 Register value = ToRegister(instr->value());
2032 Register address = ToRegister(instr->TempAt(1)); 2032 Handle<JSGlobalPropertyCell> cell_handle = instr->hydrogen()->cell();
2033 Register value = ToRegister(instr->InputAt(0));
2034 ASSERT(!value.is(object));
2035 Handle<JSGlobalPropertyCell> cell_handle(instr->hydrogen()->cell());
2036
2037 __ movq(address, cell_handle, RelocInfo::GLOBAL_PROPERTY_CELL);
2038 2033
2039 // If the cell we are storing to contains the hole it could have 2034 // If the cell we are storing to contains the hole it could have
2040 // been deleted from the property dictionary. In that case, we need 2035 // been deleted from the property dictionary. In that case, we need
2041 // to update the property details in the property dictionary to mark 2036 // to update the property details in the property dictionary to mark
2042 // it as no longer deleted. We deoptimize in that case. 2037 // it as no longer deleted. We deoptimize in that case.
2043 if (instr->hydrogen()->RequiresHoleCheck()) { 2038 if (instr->hydrogen()->RequiresHoleCheck()) {
2044 __ CompareRoot(Operand(address, 0), Heap::kTheHoleValueRootIndex); 2039 // We have a temp because CompareRoot might clobber kScratchRegister.
2040 Register cell = ToRegister(instr->TempAt(0));
2041 ASSERT(!value.is(cell));
2042 __ movq(cell, cell_handle, RelocInfo::GLOBAL_PROPERTY_CELL);
2043 __ CompareRoot(Operand(cell, 0), Heap::kTheHoleValueRootIndex);
2045 DeoptimizeIf(equal, instr->environment()); 2044 DeoptimizeIf(equal, instr->environment());
2045 // Store the value.
2046 __ movq(Operand(cell, 0), value);
2047 } else {
2048 // Store the value.
2049 __ movq(kScratchRegister, cell_handle, RelocInfo::GLOBAL_PROPERTY_CELL);
2050 __ movq(Operand(kScratchRegister, 0), value);
2046 } 2051 }
2047
2048 // Store the value.
2049 __ movq(Operand(address, 0), value);
2050 // Cells are always rescanned, so no write barrier here. 2052 // Cells are always rescanned, so no write barrier here.
2051 } 2053 }
2052 2054
2053 2055
2054 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { 2056 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
2055 ASSERT(ToRegister(instr->global_object()).is(rdx)); 2057 ASSERT(ToRegister(instr->global_object()).is(rdx));
2056 ASSERT(ToRegister(instr->value()).is(rax)); 2058 ASSERT(ToRegister(instr->value()).is(rax));
2057 2059
2058 __ Move(rcx, instr->name()); 2060 __ Move(rcx, instr->name());
2059 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) 2061 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
(...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after
4334 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 4336 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
4335 ASSERT(osr_pc_offset_ == -1); 4337 ASSERT(osr_pc_offset_ == -1);
4336 osr_pc_offset_ = masm()->pc_offset(); 4338 osr_pc_offset_ = masm()->pc_offset();
4337 } 4339 }
4338 4340
4339 #undef __ 4341 #undef __
4340 4342
4341 } } // namespace v8::internal 4343 } } // namespace v8::internal
4342 4344
4343 #endif // V8_TARGET_ARCH_X64 4345 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698