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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 6794050: Revert "[Arguments] Merge (7442,7496] from bleeding_edge." (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/arguments
Patch Set: Created 9 years, 8 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
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/regexp-macro-assembler-ia32.cc » ('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 23 matching lines...) Expand all
34 #include "debug.h" 34 #include "debug.h"
35 #include "runtime.h" 35 #include "runtime.h"
36 #include "serialize.h" 36 #include "serialize.h"
37 37
38 namespace v8 { 38 namespace v8 {
39 namespace internal { 39 namespace internal {
40 40
41 // ------------------------------------------------------------------------- 41 // -------------------------------------------------------------------------
42 // MacroAssembler implementation. 42 // MacroAssembler implementation.
43 43
44 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) 44 MacroAssembler::MacroAssembler(void* buffer, int size)
45 : Assembler(arg_isolate, buffer, size), 45 : Assembler(buffer, size),
46 generating_stub_(false), 46 generating_stub_(false),
47 allow_stub_calls_(true) { 47 allow_stub_calls_(true),
48 if (isolate() != NULL) { 48 code_object_(isolate()->heap()->undefined_value()) {
49 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(),
50 isolate());
51 }
52 } 49 }
53 50
54 51
55 void MacroAssembler::RecordWriteHelper(Register object, 52 void MacroAssembler::RecordWriteHelper(Register object,
56 Register addr, 53 Register addr,
57 Register scratch) { 54 Register scratch) {
58 if (emit_debug_code()) { 55 if (emit_debug_code()) {
59 // Check that the object is not in new space. 56 // Check that the object is not in new space.
60 Label not_in_new_space; 57 Label not_in_new_space;
61 InNewSpace(object, scratch, not_equal, &not_in_new_space); 58 InNewSpace(object, scratch, not_equal, &not_in_new_space);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 Register scratch, 224 Register scratch,
228 Label* fail) { 225 Label* fail) {
229 movzx_b(scratch, FieldOperand(map, Map::kInstanceTypeOffset)); 226 movzx_b(scratch, FieldOperand(map, Map::kInstanceTypeOffset));
230 sub(Operand(scratch), Immediate(FIRST_JS_OBJECT_TYPE)); 227 sub(Operand(scratch), Immediate(FIRST_JS_OBJECT_TYPE));
231 cmp(scratch, LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE); 228 cmp(scratch, LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE);
232 j(above, fail); 229 j(above, fail);
233 } 230 }
234 231
235 232
236 void MacroAssembler::FCmp() { 233 void MacroAssembler::FCmp() {
237 if (CpuFeatures::IsSupported(CMOV)) { 234 if (Isolate::Current()->cpu_features()->IsSupported(CMOV)) {
238 fucomip(); 235 fucomip();
239 ffree(0); 236 ffree(0);
240 fincstp(); 237 fincstp();
241 } else { 238 } else {
242 fucompp(); 239 fucompp();
243 push(eax); 240 push(eax);
244 fnstsw_ax(); 241 fnstsw_ax();
245 sahf(); 242 sahf();
246 pop(eax); 243 pop(eax);
247 } 244 }
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); 1981 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3));
1985 and_(scratch1, kFlatAsciiStringMask); 1982 and_(scratch1, kFlatAsciiStringMask);
1986 and_(scratch2, kFlatAsciiStringMask); 1983 and_(scratch2, kFlatAsciiStringMask);
1987 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); 1984 lea(scratch1, Operand(scratch1, scratch2, times_8, 0));
1988 cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3)); 1985 cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3));
1989 j(not_equal, failure); 1986 j(not_equal, failure);
1990 } 1987 }
1991 1988
1992 1989
1993 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { 1990 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
1994 int frame_alignment = OS::ActivationFrameAlignment(); 1991 // Reserve space for Isolate address which is always passed as last parameter
1995 if (frame_alignment != 0) { 1992 num_arguments += 1;
1993
1994 int frameAlignment = OS::ActivationFrameAlignment();
1995 if (frameAlignment != 0) {
1996 // Make stack end at alignment and make room for num_arguments words 1996 // Make stack end at alignment and make room for num_arguments words
1997 // and the original value of esp. 1997 // and the original value of esp.
1998 mov(scratch, esp); 1998 mov(scratch, esp);
1999 sub(Operand(esp), Immediate((num_arguments + 1) * kPointerSize)); 1999 sub(Operand(esp), Immediate((num_arguments + 1) * kPointerSize));
2000 ASSERT(IsPowerOf2(frame_alignment)); 2000 ASSERT(IsPowerOf2(frameAlignment));
2001 and_(esp, -frame_alignment); 2001 and_(esp, -frameAlignment);
2002 mov(Operand(esp, num_arguments * kPointerSize), scratch); 2002 mov(Operand(esp, num_arguments * kPointerSize), scratch);
2003 } else { 2003 } else {
2004 sub(Operand(esp), Immediate(num_arguments * kPointerSize)); 2004 sub(Operand(esp), Immediate(num_arguments * kPointerSize));
2005 } 2005 }
2006 } 2006 }
2007 2007
2008 2008
2009 void MacroAssembler::CallCFunction(ExternalReference function, 2009 void MacroAssembler::CallCFunction(ExternalReference function,
2010 int num_arguments) { 2010 int num_arguments) {
2011 // Trashing eax is ok as it will be the return value. 2011 // Trashing eax is ok as it will be the return value.
2012 mov(Operand(eax), Immediate(function)); 2012 mov(Operand(eax), Immediate(function));
2013 CallCFunction(eax, num_arguments); 2013 CallCFunction(eax, num_arguments);
2014 } 2014 }
2015 2015
2016 2016
2017 void MacroAssembler::CallCFunction(Register function, 2017 void MacroAssembler::CallCFunction(Register function,
2018 int num_arguments) { 2018 int num_arguments) {
2019 // Pass current isolate address as additional parameter.
2020 mov(Operand(esp, num_arguments * kPointerSize),
2021 Immediate(ExternalReference::isolate_address()));
2022 num_arguments += 1;
2023
2019 // Check stack alignment. 2024 // Check stack alignment.
2020 if (emit_debug_code()) { 2025 if (emit_debug_code()) {
2021 CheckStackAlignment(); 2026 CheckStackAlignment();
2022 } 2027 }
2023 2028
2024 call(Operand(function)); 2029 call(Operand(function));
2025 if (OS::ActivationFrameAlignment() != 0) { 2030 if (OS::ActivationFrameAlignment() != 0) {
2026 mov(esp, Operand(esp, num_arguments * kPointerSize)); 2031 mov(esp, Operand(esp, num_arguments * kPointerSize));
2027 } else { 2032 } else {
2028 add(Operand(esp), Immediate(num_arguments * kPointerSize)); 2033 add(Operand(esp), Immediate(num_arguments * sizeof(int32_t)));
2029 } 2034 }
2030 } 2035 }
2031 2036
2032 2037
2033 CodePatcher::CodePatcher(byte* address, int size) 2038 CodePatcher::CodePatcher(byte* address, int size)
2034 : address_(address), 2039 : address_(address), size_(size), masm_(address, size + Assembler::kGap) {
2035 size_(size),
2036 masm_(Isolate::Current(), address, size + Assembler::kGap) {
2037 // Create a new macro assembler pointing to the address of the code to patch. 2040 // Create a new macro assembler pointing to the address of the code to patch.
2038 // The size is adjusted with kGap on order for the assembler to generate size 2041 // The size is adjusted with kGap on order for the assembler to generate size
2039 // bytes of instructions without failing with buffer size constraints. 2042 // bytes of instructions without failing with buffer size constraints.
2040 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2043 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2041 } 2044 }
2042 2045
2043 2046
2044 CodePatcher::~CodePatcher() { 2047 CodePatcher::~CodePatcher() {
2045 // Indicate that code has changed. 2048 // Indicate that code has changed.
2046 CPU::FlushICache(address_, size_); 2049 CPU::FlushICache(address_, size_);
2047 2050
2048 // Check that the code was patched as expected. 2051 // Check that the code was patched as expected.
2049 ASSERT(masm_.pc_ == address_ + size_); 2052 ASSERT(masm_.pc_ == address_ + size_);
2050 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2053 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2051 } 2054 }
2052 2055
2053 2056
2054 } } // namespace v8::internal 2057 } } // namespace v8::internal
2055 2058
2056 #endif // V8_TARGET_ARCH_IA32 2059 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698