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 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 argc + 1, | 1898 argc + 1, |
1899 1); | 1899 1); |
1900 | 1900 |
1901 HandlerFrontendFooter(&miss); | 1901 HandlerFrontendFooter(&miss); |
1902 | 1902 |
1903 // Return the generated code. | 1903 // Return the generated code. |
1904 return GetCode(type, name); | 1904 return GetCode(type, name); |
1905 } | 1905 } |
1906 | 1906 |
1907 | 1907 |
1908 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( | |
1909 Handle<Object> object, | |
1910 Handle<JSObject> holder, | |
1911 Handle<Cell> cell, | |
1912 Handle<JSFunction> function, | |
1913 Handle<String> name, | |
1914 Code::StubType type) { | |
1915 // If the object is not a JSObject or we got an unexpected number of | |
1916 // arguments, bail out to the regular call. | |
1917 const int argc = arguments().immediate(); | |
1918 StackArgumentsAccessor args(rsp, argc); | |
1919 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | |
1920 | |
1921 Label miss; | |
1922 | |
1923 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
1924 if (!cell.is_null()) { | |
1925 ASSERT(cell->value() == *function); | |
1926 GenerateLoadFunctionFromCell(cell, function, &miss); | |
1927 } | |
1928 | |
1929 // Load the char code argument. | |
1930 Register code = rbx; | |
1931 __ movq(code, args.GetArgumentOperand(1)); | |
1932 | |
1933 // Check the code is a smi. | |
1934 Label slow; | |
1935 __ JumpIfNotSmi(code, &slow); | |
1936 | |
1937 // Convert the smi code to uint16. | |
1938 __ SmiAndConstant(code, code, Smi::FromInt(0xffff)); | |
1939 | |
1940 StringCharFromCodeGenerator generator(code, rax); | |
1941 generator.GenerateFast(masm()); | |
1942 __ ret(2 * kPointerSize); | |
1943 | |
1944 StubRuntimeCallHelper call_helper; | |
1945 generator.GenerateSlow(masm(), call_helper); | |
1946 | |
1947 __ bind(&slow); | |
1948 // We do not have to patch the receiver because the function makes no use of | |
1949 // it. | |
1950 GenerateJumpFunctionIgnoreReceiver(function); | |
1951 | |
1952 HandlerFrontendFooter(&miss); | |
1953 | |
1954 // Return the generated code. | |
1955 return GetCode(type, name); | |
1956 } | |
1957 | |
1958 | |
1959 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1908 Handle<Code> CallStubCompiler::CompileFastApiCall( |
1960 const CallOptimization& optimization, | 1909 const CallOptimization& optimization, |
1961 Handle<Object> object, | 1910 Handle<Object> object, |
1962 Handle<JSObject> holder, | 1911 Handle<JSObject> holder, |
1963 Handle<Cell> cell, | 1912 Handle<Cell> cell, |
1964 Handle<JSFunction> function, | 1913 Handle<JSFunction> function, |
1965 Handle<String> name) { | 1914 Handle<String> name) { |
1966 ASSERT(optimization.is_simple_api_call()); | 1915 ASSERT(optimization.is_simple_api_call()); |
1967 // Bail out if object is a global object as we don't want to | 1916 // Bail out if object is a global object as we don't want to |
1968 // repatch it to global receiver. | 1917 // repatch it to global receiver. |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 // ----------------------------------- | 2504 // ----------------------------------- |
2556 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2505 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2557 } | 2506 } |
2558 | 2507 |
2559 | 2508 |
2560 #undef __ | 2509 #undef __ |
2561 | 2510 |
2562 } } // namespace v8::internal | 2511 } } // namespace v8::internal |
2563 | 2512 |
2564 #endif // V8_TARGET_ARCH_X64 | 2513 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |