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 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1932 cmp(edi, Operand::StaticVariable(limit_address)); | 1932 cmp(edi, Operand::StaticVariable(limit_address)); |
1933 j(not_equal, &delete_allocated_handles); | 1933 j(not_equal, &delete_allocated_handles); |
1934 bind(&leave_exit_frame); | 1934 bind(&leave_exit_frame); |
1935 | 1935 |
1936 // Check if the function scheduled an exception. | 1936 // Check if the function scheduled an exception. |
1937 ExternalReference scheduled_exception_address = | 1937 ExternalReference scheduled_exception_address = |
1938 ExternalReference::scheduled_exception_address(isolate()); | 1938 ExternalReference::scheduled_exception_address(isolate()); |
1939 cmp(Operand::StaticVariable(scheduled_exception_address), | 1939 cmp(Operand::StaticVariable(scheduled_exception_address), |
1940 Immediate(isolate()->factory()->the_hole_value())); | 1940 Immediate(isolate()->factory()->the_hole_value())); |
1941 j(not_equal, &promote_scheduled_exception); | 1941 j(not_equal, &promote_scheduled_exception); |
1942 | |
1943 #if ENABLE_EXTRA_CHECKS | |
1944 // Check if the function returned a valid JavaScript value. | |
1945 Label ok; | |
1946 Register return_value = eax; | |
1947 Register map = ecx; | |
1948 | |
1949 JumpIfSmi(return_value, &ok, Label::kNear); | |
1950 mov(map, FieldOperand(return_value, HeapObject::kMapOffset)); | |
1951 | |
1952 CmpInstanceType(map, FIRST_NONSTRING_TYPE); | |
1953 j(below, &ok, Label::kNear); | |
1954 | |
1955 CmpInstanceType(map, FIRST_SPEC_OBJECT_TYPE); | |
1956 j(above_equal, &ok, Label::kNear); | |
1957 | |
1958 cmp(map, isolate()->factory()->heap_number_map()); | |
1959 j(equal, &ok, Label::kNear); | |
1960 | |
1961 cmp(return_value, isolate()->factory()->undefined_value()); | |
Jakob Kummerow
2012/09/05 14:08:51
I guess you don't want to do a CmpInstanceType(map
Sven Panne
2012/09/05 14:11:47
Yes, and things are stricter this way, because som
| |
1962 j(equal, &ok, Label::kNear); | |
1963 | |
1964 cmp(return_value, isolate()->factory()->true_value()); | |
1965 j(equal, &ok, Label::kNear); | |
1966 | |
1967 cmp(return_value, isolate()->factory()->false_value()); | |
1968 j(equal, &ok, Label::kNear); | |
1969 | |
1970 cmp(return_value, isolate()->factory()->null_value()); | |
1971 j(equal, &ok, Label::kNear); | |
1972 | |
1973 Abort("API call returned invalid object"); | |
1974 | |
1975 bind(&ok); | |
1976 #endif | |
1977 | |
1942 LeaveApiExitFrame(); | 1978 LeaveApiExitFrame(); |
1943 ret(stack_space * kPointerSize); | 1979 ret(stack_space * kPointerSize); |
1944 | 1980 |
1945 bind(&empty_handle); | 1981 bind(&empty_handle); |
1946 // It was zero; the result is undefined. | 1982 // It was zero; the result is undefined. |
1947 mov(eax, isolate()->factory()->undefined_value()); | 1983 mov(eax, isolate()->factory()->undefined_value()); |
1948 jmp(&prologue); | 1984 jmp(&prologue); |
1949 | 1985 |
1950 bind(&promote_scheduled_exception); | 1986 bind(&promote_scheduled_exception); |
1951 TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); | 1987 TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1); |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2935 j(not_equal, call_runtime); | 2971 j(not_equal, call_runtime); |
2936 | 2972 |
2937 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); | 2973 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); |
2938 cmp(ecx, isolate()->factory()->null_value()); | 2974 cmp(ecx, isolate()->factory()->null_value()); |
2939 j(not_equal, &next); | 2975 j(not_equal, &next); |
2940 } | 2976 } |
2941 | 2977 |
2942 } } // namespace v8::internal | 2978 } } // namespace v8::internal |
2943 | 2979 |
2944 #endif // V8_TARGET_ARCH_IA32 | 2980 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |