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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 | 976 |
977 // Load current lexical context from the stack frame. | 977 // Load current lexical context from the stack frame. |
978 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset)); | 978 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset)); |
979 | 979 |
980 // When generating debug code, make sure the lexical context is set. | 980 // When generating debug code, make sure the lexical context is set. |
981 if (emit_debug_code()) { | 981 if (emit_debug_code()) { |
982 cmp(scratch, Immediate(0)); | 982 cmp(scratch, Immediate(0)); |
983 Check(not_equal, "we should not have an empty lexical context"); | 983 Check(not_equal, "we should not have an empty lexical context"); |
984 } | 984 } |
985 // Load the native context of the current context. | 985 // Load the native context of the current context. |
986 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 986 int offset = |
| 987 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
987 mov(scratch, FieldOperand(scratch, offset)); | 988 mov(scratch, FieldOperand(scratch, offset)); |
988 mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 989 mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
989 | 990 |
990 // Check the context is a native context. | 991 // Check the context is a native context. |
991 if (emit_debug_code()) { | 992 if (emit_debug_code()) { |
992 push(scratch); | 993 push(scratch); |
993 // Read the first word and compare to native_context_map. | 994 // Read the first word and compare to native_context_map. |
994 mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); | 995 mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); |
995 cmp(scratch, isolate()->factory()->native_context_map()); | 996 cmp(scratch, isolate()->factory()->native_context_map()); |
996 Check(equal, "JSGlobalObject::native_context should be a native context."); | 997 Check(equal, "JSGlobalObject::native_context should be a native context."); |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 ParameterCount expected(0); | 2164 ParameterCount expected(0); |
2164 GetBuiltinFunction(edi, id); | 2165 GetBuiltinFunction(edi, id); |
2165 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 2166 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
2166 expected, expected, flag, call_wrapper, CALL_AS_METHOD); | 2167 expected, expected, flag, call_wrapper, CALL_AS_METHOD); |
2167 } | 2168 } |
2168 | 2169 |
2169 | 2170 |
2170 void MacroAssembler::GetBuiltinFunction(Register target, | 2171 void MacroAssembler::GetBuiltinFunction(Register target, |
2171 Builtins::JavaScript id) { | 2172 Builtins::JavaScript id) { |
2172 // Load the JavaScript builtin function from the builtins object. | 2173 // Load the JavaScript builtin function from the builtins object. |
2173 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2174 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2174 mov(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); | 2175 mov(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); |
2175 mov(target, FieldOperand(target, | 2176 mov(target, FieldOperand(target, |
2176 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | 2177 JSBuiltinsObject::OffsetOfFunctionWithId(id))); |
2177 } | 2178 } |
2178 | 2179 |
2179 | 2180 |
2180 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { | 2181 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { |
2181 ASSERT(!target.is(edi)); | 2182 ASSERT(!target.is(edi)); |
2182 // Load the JavaScript builtin function from the builtins object. | 2183 // Load the JavaScript builtin function from the builtins object. |
2183 GetBuiltinFunction(edi, id); | 2184 GetBuiltinFunction(edi, id); |
(...skipping 28 matching lines...) Expand all Loading... |
2212 } | 2213 } |
2213 | 2214 |
2214 | 2215 |
2215 void MacroAssembler::LoadTransitionedArrayMapConditional( | 2216 void MacroAssembler::LoadTransitionedArrayMapConditional( |
2216 ElementsKind expected_kind, | 2217 ElementsKind expected_kind, |
2217 ElementsKind transitioned_kind, | 2218 ElementsKind transitioned_kind, |
2218 Register map_in_out, | 2219 Register map_in_out, |
2219 Register scratch, | 2220 Register scratch, |
2220 Label* no_map_match) { | 2221 Label* no_map_match) { |
2221 // Load the global or builtins object from the current context. | 2222 // Load the global or builtins object from the current context. |
2222 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2223 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2223 mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 2224 mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
2224 | 2225 |
2225 // Check that the function's map is the same as the expected cached map. | 2226 // Check that the function's map is the same as the expected cached map. |
2226 mov(scratch, Operand(scratch, | 2227 mov(scratch, Operand(scratch, |
2227 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 2228 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
2228 | 2229 |
2229 size_t offset = expected_kind * kPointerSize + | 2230 size_t offset = expected_kind * kPointerSize + |
2230 FixedArrayBase::kHeaderSize; | 2231 FixedArrayBase::kHeaderSize; |
2231 cmp(map_in_out, FieldOperand(scratch, offset)); | 2232 cmp(map_in_out, FieldOperand(scratch, offset)); |
2232 j(not_equal, no_map_match); | 2233 j(not_equal, no_map_match); |
(...skipping 25 matching lines...) Expand all Loading... |
2258 map_out, | 2259 map_out, |
2259 scratch, | 2260 scratch, |
2260 &done); | 2261 &done); |
2261 } | 2262 } |
2262 bind(&done); | 2263 bind(&done); |
2263 } | 2264 } |
2264 | 2265 |
2265 | 2266 |
2266 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2267 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
2267 // Load the global or builtins object from the current context. | 2268 // Load the global or builtins object from the current context. |
2268 mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2269 mov(function, |
| 2270 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2269 // Load the native context from the global or builtins object. | 2271 // Load the native context from the global or builtins object. |
2270 mov(function, FieldOperand(function, GlobalObject::kNativeContextOffset)); | 2272 mov(function, FieldOperand(function, GlobalObject::kNativeContextOffset)); |
2271 // Load the function from the native context. | 2273 // Load the function from the native context. |
2272 mov(function, Operand(function, Context::SlotOffset(index))); | 2274 mov(function, Operand(function, Context::SlotOffset(index))); |
2273 } | 2275 } |
2274 | 2276 |
2275 | 2277 |
2276 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 2278 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
2277 Register map) { | 2279 Register map) { |
2278 // Load the initial map. The global functions all have initial maps. | 2280 // Load the initial map. The global functions all have initial maps. |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 // Load the prototype from the map and loop if non-null. | 2923 // Load the prototype from the map and loop if non-null. |
2922 bind(&check_prototype); | 2924 bind(&check_prototype); |
2923 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); | 2925 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); |
2924 cmp(ecx, isolate()->factory()->null_value()); | 2926 cmp(ecx, isolate()->factory()->null_value()); |
2925 j(not_equal, &next); | 2927 j(not_equal, &next); |
2926 } | 2928 } |
2927 | 2929 |
2928 } } // namespace v8::internal | 2930 } } // namespace v8::internal |
2929 | 2931 |
2930 #endif // V8_TARGET_ARCH_IA32 | 2932 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |