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

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

Issue 6390003: Introduce a hydrogen value for contexts, support context slot assignment. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Sorted Lithium instructions names. Created 9 years, 10 months 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
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 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 __ cmp(cell_operand, Factory::the_hole_value()); 1907 __ cmp(cell_operand, Factory::the_hole_value());
1908 DeoptimizeIf(equal, instr->environment()); 1908 DeoptimizeIf(equal, instr->environment());
1909 } 1909 }
1910 1910
1911 // Store the value. 1911 // Store the value.
1912 __ mov(cell_operand, value); 1912 __ mov(cell_operand, value);
1913 } 1913 }
1914 1914
1915 1915
1916 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { 1916 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
1917 // TODO(antonm): load a context with a separate instruction. 1917 Register context = ToRegister(instr->InputAt(0));
1918 Register result = ToRegister(instr->result()); 1918 Register result = ToRegister(instr->result());
1919 __ LoadContext(result, instr->context_chain_length()); 1919 __ mov(result,
1920 Operand(context, Context::SlotOffset(Context::FCONTEXT_INDEX)));
1920 __ mov(result, ContextOperand(result, instr->slot_index())); 1921 __ mov(result, ContextOperand(result, instr->slot_index()));
1921 } 1922 }
1922 1923
1923 1924
1925 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
1926 Register context = ToRegister(instr->context());
1927 Register value = ToRegister(instr->value());
1928 __ mov(context,
1929 Operand(context, Context::SlotOffset(Context::FCONTEXT_INDEX)));
1930 __ mov(ContextOperand(context, instr->slot_index()), value);
1931 if (instr->needs_write_barrier()) {
1932 Register temp = ToRegister(instr->TempAt(0));
1933 int offset = Context::SlotOffset(instr->slot_index());
1934 __ RecordWrite(context, offset, value, temp);
1935 }
1936 }
1937
1938
1924 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 1939 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
1925 Register object = ToRegister(instr->InputAt(0)); 1940 Register object = ToRegister(instr->InputAt(0));
1926 Register result = ToRegister(instr->result()); 1941 Register result = ToRegister(instr->result());
1927 if (instr->hydrogen()->is_in_object()) { 1942 if (instr->hydrogen()->is_in_object()) {
1928 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); 1943 __ mov(result, FieldOperand(object, instr->hydrogen()->offset()));
1929 } else { 1944 } else {
1930 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); 1945 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset));
1931 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); 1946 __ mov(result, FieldOperand(result, instr->hydrogen()->offset()));
1932 } 1947 }
1933 } 1948 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 void LCodeGen::DoPushArgument(LPushArgument* instr) { 2163 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2149 LOperand* argument = instr->InputAt(0); 2164 LOperand* argument = instr->InputAt(0);
2150 if (argument->IsConstantOperand()) { 2165 if (argument->IsConstantOperand()) {
2151 __ push(ToImmediate(argument)); 2166 __ push(ToImmediate(argument));
2152 } else { 2167 } else {
2153 __ push(ToOperand(argument)); 2168 __ push(ToOperand(argument));
2154 } 2169 }
2155 } 2170 }
2156 2171
2157 2172
2173 void LCodeGen::DoContext(LContext* instr) {
2174 Register result = ToRegister(instr->result());
2175 __ mov(result, esi);
2176 }
2177
2178
2179 void LCodeGen::DoOuterContext(LOuterContext* instr) {
2180 Register context = ToRegister(instr->context());
2181 Register result = ToRegister(instr->result());
2182 __ mov(result, Operand(context, Context::SlotOffset(Context::CLOSURE_INDEX)));
2183 __ mov(result, FieldOperand(result, JSFunction::kContextOffset));
2184 }
2185
2186
2158 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { 2187 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
2188 Register context = ToRegister(instr->context());
2159 Register result = ToRegister(instr->result()); 2189 Register result = ToRegister(instr->result());
2160 __ mov(result, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 2190 __ mov(result, Operand(context, Context::SlotOffset(Context::GLOBAL_INDEX)));
2161 } 2191 }
2162 2192
2163 2193
2164 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { 2194 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2195 Register global = ToRegister(instr->global());
2165 Register result = ToRegister(instr->result()); 2196 Register result = ToRegister(instr->result());
2166 __ mov(result, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 2197 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset));
2167 __ mov(result, FieldOperand(result, GlobalObject::kGlobalReceiverOffset));
2168 } 2198 }
2169 2199
2170 2200
2171 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 2201 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
2172 int arity, 2202 int arity,
2173 LInstruction* instr) { 2203 LInstruction* instr) {
2174 // Change context if needed. 2204 // Change context if needed.
2175 bool change_context = 2205 bool change_context =
2176 (graph()->info()->closure()->context() != function->context()) || 2206 (graph()->info()->closure()->context() != function->context()) ||
2177 scope()->contains_with() || 2207 scope()->contains_with() ||
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
3608 ASSERT(osr_pc_offset_ == -1); 3638 ASSERT(osr_pc_offset_ == -1);
3609 osr_pc_offset_ = masm()->pc_offset(); 3639 osr_pc_offset_ = masm()->pc_offset();
3610 } 3640 }
3611 3641
3612 3642
3613 #undef __ 3643 #undef __
3614 3644
3615 } } // namespace v8::internal 3645 } } // namespace v8::internal
3616 3646
3617 #endif // V8_TARGET_ARCH_IA32 3647 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698