OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 Label ok; | 1912 Label ok; |
1913 test(result, result); | 1913 test(result, result); |
1914 j(not_zero, &ok); | 1914 j(not_zero, &ok); |
1915 mov(scratch, op1); | 1915 mov(scratch, op1); |
1916 or_(scratch, op2); | 1916 or_(scratch, op2); |
1917 j(sign, then_label); | 1917 j(sign, then_label); |
1918 bind(&ok); | 1918 bind(&ok); |
1919 } | 1919 } |
1920 | 1920 |
1921 | 1921 |
| 1922 void MacroAssembler::GetMapConstructor(Register result, Register map, |
| 1923 Register temp) { |
| 1924 Label done, loop; |
| 1925 mov(result, FieldOperand(map, Map::kConstructorOrBackPointerOffset)); |
| 1926 bind(&loop); |
| 1927 JumpIfSmi(result, &done); |
| 1928 CmpObjectType(result, MAP_TYPE, temp); |
| 1929 j(not_equal, &done); |
| 1930 mov(result, FieldOperand(result, Map::kConstructorOrBackPointerOffset)); |
| 1931 jmp(&loop); |
| 1932 bind(&done); |
| 1933 } |
| 1934 |
| 1935 |
1922 void MacroAssembler::TryGetFunctionPrototype(Register function, | 1936 void MacroAssembler::TryGetFunctionPrototype(Register function, |
1923 Register result, | 1937 Register result, |
1924 Register scratch, | 1938 Register scratch, |
1925 Label* miss, | 1939 Label* miss, |
1926 bool miss_on_bound_function) { | 1940 bool miss_on_bound_function) { |
1927 Label non_instance; | 1941 Label non_instance; |
1928 if (miss_on_bound_function) { | 1942 if (miss_on_bound_function) { |
1929 // Check that the receiver isn't a smi. | 1943 // Check that the receiver isn't a smi. |
1930 JumpIfSmi(function, miss); | 1944 JumpIfSmi(function, miss); |
1931 | 1945 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 | 1977 |
1964 // Get the prototype from the initial map. | 1978 // Get the prototype from the initial map. |
1965 mov(result, FieldOperand(result, Map::kPrototypeOffset)); | 1979 mov(result, FieldOperand(result, Map::kPrototypeOffset)); |
1966 | 1980 |
1967 if (miss_on_bound_function) { | 1981 if (miss_on_bound_function) { |
1968 jmp(&done); | 1982 jmp(&done); |
1969 | 1983 |
1970 // Non-instance prototype: Fetch prototype from constructor field | 1984 // Non-instance prototype: Fetch prototype from constructor field |
1971 // in initial map. | 1985 // in initial map. |
1972 bind(&non_instance); | 1986 bind(&non_instance); |
1973 mov(result, FieldOperand(result, Map::kConstructorOffset)); | 1987 GetMapConstructor(result, result, scratch); |
1974 } | 1988 } |
1975 | 1989 |
1976 // All done. | 1990 // All done. |
1977 bind(&done); | 1991 bind(&done); |
1978 } | 1992 } |
1979 | 1993 |
1980 | 1994 |
1981 void MacroAssembler::CallStub(CodeStub* stub, TypeFeedbackId ast_id) { | 1995 void MacroAssembler::CallStub(CodeStub* stub, TypeFeedbackId ast_id) { |
1982 DCHECK(AllowThisStubCall(stub)); // Calls are not allowed in some stubs. | 1996 DCHECK(AllowThisStubCall(stub)); // Calls are not allowed in some stubs. |
1983 call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id); | 1997 call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id); |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3283 if (mag.shift > 0) sar(edx, mag.shift); | 3297 if (mag.shift > 0) sar(edx, mag.shift); |
3284 mov(eax, dividend); | 3298 mov(eax, dividend); |
3285 shr(eax, 31); | 3299 shr(eax, 31); |
3286 add(edx, eax); | 3300 add(edx, eax); |
3287 } | 3301 } |
3288 | 3302 |
3289 | 3303 |
3290 } } // namespace v8::internal | 3304 } } // namespace v8::internal |
3291 | 3305 |
3292 #endif // V8_TARGET_ARCH_IA32 | 3306 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |