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 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 argc + 1, | 1974 argc + 1, |
1975 1); | 1975 1); |
1976 | 1976 |
1977 HandlerFrontendFooter(&miss); | 1977 HandlerFrontendFooter(&miss); |
1978 | 1978 |
1979 // Return the generated code. | 1979 // Return the generated code. |
1980 return GetCode(type, name); | 1980 return GetCode(type, name); |
1981 } | 1981 } |
1982 | 1982 |
1983 | 1983 |
1984 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( | |
1985 Handle<Object> object, | |
1986 Handle<JSObject> holder, | |
1987 Handle<Cell> cell, | |
1988 Handle<JSFunction> function, | |
1989 Handle<String> name, | |
1990 Code::StubType type) { | |
1991 const int argc = arguments().immediate(); | |
1992 | |
1993 // If the object is not a JSObject or we got an unexpected number of | |
1994 // arguments, bail out to the regular call. | |
1995 if (!object->IsJSObject() || argc != 1) { | |
1996 return Handle<Code>::null(); | |
1997 } | |
1998 | |
1999 Label miss; | |
2000 | |
2001 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
2002 if (!cell.is_null()) { | |
2003 ASSERT(cell->value() == *function); | |
2004 GenerateLoadFunctionFromCell(cell, function, &miss); | |
2005 } | |
2006 | |
2007 // Load the char code argument. | |
2008 Register code = ebx; | |
2009 __ mov(code, Operand(esp, 1 * kPointerSize)); | |
2010 | |
2011 // Check the code is a smi. | |
2012 Label slow; | |
2013 STATIC_ASSERT(kSmiTag == 0); | |
2014 __ JumpIfNotSmi(code, &slow); | |
2015 | |
2016 // Convert the smi code to uint16. | |
2017 __ and_(code, Immediate(Smi::FromInt(0xffff))); | |
2018 | |
2019 StringCharFromCodeGenerator generator(code, eax); | |
2020 generator.GenerateFast(masm()); | |
2021 __ ret(2 * kPointerSize); | |
2022 | |
2023 StubRuntimeCallHelper call_helper; | |
2024 generator.GenerateSlow(masm(), call_helper); | |
2025 | |
2026 __ bind(&slow); | |
2027 // We do not have to patch the receiver because the function makes no use of | |
2028 // it. | |
2029 GenerateJumpFunctionIgnoreReceiver(function); | |
2030 | |
2031 HandlerFrontendFooter(&miss); | |
2032 | |
2033 // Return the generated code. | |
2034 return GetCode(type, name); | |
2035 } | |
2036 | |
2037 | |
2038 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1984 Handle<Code> CallStubCompiler::CompileFastApiCall( |
2039 const CallOptimization& optimization, | 1985 const CallOptimization& optimization, |
2040 Handle<Object> object, | 1986 Handle<Object> object, |
2041 Handle<JSObject> holder, | 1987 Handle<JSObject> holder, |
2042 Handle<Cell> cell, | 1988 Handle<Cell> cell, |
2043 Handle<JSFunction> function, | 1989 Handle<JSFunction> function, |
2044 Handle<String> name) { | 1990 Handle<String> name) { |
2045 ASSERT(optimization.is_simple_api_call()); | 1991 ASSERT(optimization.is_simple_api_call()); |
2046 // Bail out if object is a global object as we don't want to | 1992 // Bail out if object is a global object as we don't want to |
2047 // repatch it to global receiver. | 1993 // repatch it to global receiver. |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 // ----------------------------------- | 2575 // ----------------------------------- |
2630 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2576 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2631 } | 2577 } |
2632 | 2578 |
2633 | 2579 |
2634 #undef __ | 2580 #undef __ |
2635 | 2581 |
2636 } } // namespace v8::internal | 2582 } } // namespace v8::internal |
2637 | 2583 |
2638 #endif // V8_TARGET_ARCH_IA32 | 2584 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |