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

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: 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 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 __ cmp(cell_operand, Factory::the_hole_value()); 1921 __ cmp(cell_operand, Factory::the_hole_value());
1922 DeoptimizeIf(equal, instr->environment()); 1922 DeoptimizeIf(equal, instr->environment());
1923 } 1923 }
1924 1924
1925 // Store the value. 1925 // Store the value.
1926 __ mov(cell_operand, value); 1926 __ mov(cell_operand, value);
1927 } 1927 }
1928 1928
1929 1929
1930 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { 1930 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
1931 // TODO(antonm): load a context with a separate instruction. 1931 Register context = ToRegister(instr->InputAt(0));
1932 Register result = ToRegister(instr->result()); 1932 Register result = ToRegister(instr->result());
1933 __ LoadContext(result, instr->context_chain_length()); 1933 __ mov(result,
1934 Operand(context, Context::SlotOffset(Context::FCONTEXT_INDEX)));
antonm 2011/01/27 14:00:07 maybe introduce additional instruction for this lo
1934 __ mov(result, ContextOperand(result, instr->slot_index())); 1935 __ mov(result, ContextOperand(result, instr->slot_index()));
1935 } 1936 }
1936 1937
1937 1938
1939 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
1940 Register context = ToRegister(instr->InputAt(0));
1941 Register value = ToRegister(instr->InputAt(1));
1942 __ mov(context,
1943 Operand(context, Context::SlotOffset(Context::FCONTEXT_INDEX)));
1944 __ mov(ContextOperand(context, instr->slot_index()), value);
1945 if (instr->TempAt(0) != NULL) {
1946 Register temp = ToRegister(instr->TempAt(0));
1947 int offset = Context::SlotOffset(instr->slot_index());
1948 __ RecordWrite(context, offset, value, temp);
1949 }
1950 }
1951
1952
1938 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 1953 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
1939 Register object = ToRegister(instr->InputAt(0)); 1954 Register object = ToRegister(instr->InputAt(0));
1940 Register result = ToRegister(instr->result()); 1955 Register result = ToRegister(instr->result());
1941 if (instr->hydrogen()->is_in_object()) { 1956 if (instr->hydrogen()->is_in_object()) {
1942 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); 1957 __ mov(result, FieldOperand(object, instr->hydrogen()->offset()));
1943 } else { 1958 } else {
1944 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); 1959 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset));
1945 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); 1960 __ mov(result, FieldOperand(result, instr->hydrogen()->offset()));
1946 } 1961 }
1947 } 1962 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 void LCodeGen::DoPushArgument(LPushArgument* instr) { 2172 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2158 LOperand* argument = instr->InputAt(0); 2173 LOperand* argument = instr->InputAt(0);
2159 if (argument->IsConstantOperand()) { 2174 if (argument->IsConstantOperand()) {
2160 __ push(ToImmediate(argument)); 2175 __ push(ToImmediate(argument));
2161 } else { 2176 } else {
2162 __ push(ToOperand(argument)); 2177 __ push(ToOperand(argument));
2163 } 2178 }
2164 } 2179 }
2165 2180
2166 2181
2182 void LCodeGen::DoContext(LContext* instr) {
2183 Register result = ToRegister(instr->result());
2184 __ mov(result, esi);
antonm 2011/01/27 14:00:07 Can we make it noop by requesting the result regis
fschneider 2011/01/28 11:54:50 esi will be replaced by [fixed-stack-slot] - so i'
2185 }
2186
2187
2188 void LCodeGen::DoOuterContext(LOuterContext* instr) {
2189 Register context = ToRegister(instr->InputAt(0));
2190 Register result = ToRegister(instr->result());
2191 __ mov(result, Operand(context, Context::SlotOffset(Context::CLOSURE_INDEX)));
2192 __ mov(result, FieldOperand(result, JSFunction::kContextOffset));
2193 }
2194
2195
2167 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { 2196 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
2197 Register context = ToRegister(instr->InputAt(0));
2168 Register result = ToRegister(instr->result()); 2198 Register result = ToRegister(instr->result());
2169 __ mov(result, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 2199 __ mov(result, Operand(context, Context::SlotOffset(Context::GLOBAL_INDEX)));
2170 } 2200 }
2171 2201
2172 2202
2173 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { 2203 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2204 Register global = ToRegister(instr->InputAt(0));
2174 Register result = ToRegister(instr->result()); 2205 Register result = ToRegister(instr->result());
2175 __ mov(result, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 2206 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset));
2176 __ mov(result, FieldOperand(result, GlobalObject::kGlobalReceiverOffset));
2177 } 2207 }
2178 2208
2179 2209
2180 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 2210 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
2181 int arity, 2211 int arity,
2182 LInstruction* instr) { 2212 LInstruction* instr) {
2183 // Change context if needed. 2213 // Change context if needed.
2184 bool change_context = 2214 bool change_context =
2185 (graph()->info()->closure()->context() != function->context()) || 2215 (graph()->info()->closure()->context() != function->context()) ||
2186 scope()->contains_with() || 2216 scope()->contains_with() ||
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
3611 ASSERT(osr_pc_offset_ == -1); 3641 ASSERT(osr_pc_offset_ == -1);
3612 osr_pc_offset_ = masm()->pc_offset(); 3642 osr_pc_offset_ = masm()->pc_offset();
3613 } 3643 }
3614 3644
3615 3645
3616 #undef __ 3646 #undef __
3617 3647
3618 } } // namespace v8::internal 3648 } } // namespace v8::internal
3619 3649
3620 #endif // V8_TARGET_ARCH_IA32 3650 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698