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

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

Issue 6691054: [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(void* buffer, int size) 44 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
45 : Assembler(buffer, size), 45 : Assembler(arg_isolate, buffer, size),
46 generating_stub_(false), 46 generating_stub_(false),
47 allow_stub_calls_(true), 47 allow_stub_calls_(true) {
48 code_object_(isolate()->heap()->undefined_value()) { 48 if (isolate() != NULL) {
49 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(),
50 isolate());
51 }
49 } 52 }
50 53
51 54
52 void MacroAssembler::RecordWriteHelper(Register object, 55 void MacroAssembler::RecordWriteHelper(Register object,
53 Register addr, 56 Register addr,
54 Register scratch) { 57 Register scratch) {
55 if (emit_debug_code()) { 58 if (emit_debug_code()) {
56 // Check that the object is not in new space. 59 // Check that the object is not in new space.
57 Label not_in_new_space; 60 Label not_in_new_space;
58 InNewSpace(object, scratch, not_equal, &not_in_new_space); 61 InNewSpace(object, scratch, not_equal, &not_in_new_space);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 Register scratch, 227 Register scratch,
225 Label* fail) { 228 Label* fail) {
226 movzx_b(scratch, FieldOperand(map, Map::kInstanceTypeOffset)); 229 movzx_b(scratch, FieldOperand(map, Map::kInstanceTypeOffset));
227 sub(Operand(scratch), Immediate(FIRST_JS_OBJECT_TYPE)); 230 sub(Operand(scratch), Immediate(FIRST_JS_OBJECT_TYPE));
228 cmp(scratch, LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE); 231 cmp(scratch, LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE);
229 j(above, fail); 232 j(above, fail);
230 } 233 }
231 234
232 235
233 void MacroAssembler::FCmp() { 236 void MacroAssembler::FCmp() {
234 if (Isolate::Current()->cpu_features()->IsSupported(CMOV)) { 237 if (CpuFeatures::IsSupported(CMOV)) {
235 fucomip(); 238 fucomip();
236 ffree(0); 239 ffree(0);
237 fincstp(); 240 fincstp();
238 } else { 241 } else {
239 fucompp(); 242 fucompp();
240 push(eax); 243 push(eax);
241 fnstsw_ax(); 244 fnstsw_ax();
242 sahf(); 245 sahf();
243 pop(eax); 246 pop(eax);
244 } 247 }
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); 1984 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3));
1982 and_(scratch1, kFlatAsciiStringMask); 1985 and_(scratch1, kFlatAsciiStringMask);
1983 and_(scratch2, kFlatAsciiStringMask); 1986 and_(scratch2, kFlatAsciiStringMask);
1984 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); 1987 lea(scratch1, Operand(scratch1, scratch2, times_8, 0));
1985 cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3)); 1988 cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3));
1986 j(not_equal, failure); 1989 j(not_equal, failure);
1987 } 1990 }
1988 1991
1989 1992
1990 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { 1993 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
1991 // Reserve space for Isolate address which is always passed as last parameter 1994 int frame_alignment = OS::ActivationFrameAlignment();
1992 num_arguments += 1; 1995 if (frame_alignment != 0) {
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(frameAlignment)); 2000 ASSERT(IsPowerOf2(frame_alignment));
2001 and_(esp, -frameAlignment); 2001 and_(esp, -frame_alignment);
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
2024 // Check stack alignment. 2019 // Check stack alignment.
2025 if (emit_debug_code()) { 2020 if (emit_debug_code()) {
2026 CheckStackAlignment(); 2021 CheckStackAlignment();
2027 } 2022 }
2028 2023
2029 call(Operand(function)); 2024 call(Operand(function));
2030 if (OS::ActivationFrameAlignment() != 0) { 2025 if (OS::ActivationFrameAlignment() != 0) {
2031 mov(esp, Operand(esp, num_arguments * kPointerSize)); 2026 mov(esp, Operand(esp, num_arguments * kPointerSize));
2032 } else { 2027 } else {
2033 add(Operand(esp), Immediate(num_arguments * sizeof(int32_t))); 2028 add(Operand(esp), Immediate(num_arguments * kPointerSize));
2034 } 2029 }
2035 } 2030 }
2036 2031
2037 2032
2038 CodePatcher::CodePatcher(byte* address, int size) 2033 CodePatcher::CodePatcher(byte* address, int size)
2039 : address_(address), size_(size), masm_(address, size + Assembler::kGap) { 2034 : address_(address),
2035 size_(size),
2036 masm_(Isolate::Current(), address, size + Assembler::kGap) {
2040 // Create a new macro assembler pointing to the address of the code to patch. 2037 // Create a new macro assembler pointing to the address of the code to patch.
2041 // The size is adjusted with kGap on order for the assembler to generate size 2038 // The size is adjusted with kGap on order for the assembler to generate size
2042 // bytes of instructions without failing with buffer size constraints. 2039 // bytes of instructions without failing with buffer size constraints.
2043 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2040 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2044 } 2041 }
2045 2042
2046 2043
2047 CodePatcher::~CodePatcher() { 2044 CodePatcher::~CodePatcher() {
2048 // Indicate that code has changed. 2045 // Indicate that code has changed.
2049 CPU::FlushICache(address_, size_); 2046 CPU::FlushICache(address_, size_);
2050 2047
2051 // Check that the code was patched as expected. 2048 // Check that the code was patched as expected.
2052 ASSERT(masm_.pc_ == address_ + size_); 2049 ASSERT(masm_.pc_ == address_ + size_);
2053 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2050 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2054 } 2051 }
2055 2052
2056 2053
2057 } } // namespace v8::internal 2054 } } // namespace v8::internal
2058 2055
2059 #endif // V8_TARGET_ARCH_IA32 2056 #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