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

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

Issue 13177002: Remove push(holder_reg) in CheckAccessGlobalProxy. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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/stub-cache-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 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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 1017
1018 // Clear the context pointer and frame pointer (0 was saved in the handler). 1018 // Clear the context pointer and frame pointer (0 was saved in the handler).
1019 pop(esi); 1019 pop(esi);
1020 pop(ebp); 1020 pop(ebp);
1021 1021
1022 JumpToHandlerEntry(); 1022 JumpToHandlerEntry();
1023 } 1023 }
1024 1024
1025 1025
1026 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, 1026 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
1027 Register scratch, 1027 Register scratch1,
1028 Register scratch2,
1028 Label* miss) { 1029 Label* miss) {
1029 Label same_contexts; 1030 Label same_contexts;
1030 1031
1031 ASSERT(!holder_reg.is(scratch)); 1032 ASSERT(!holder_reg.is(scratch1));
1033 ASSERT(!holder_reg.is(scratch2));
1034 ASSERT(!scratch1.is(scratch2));
1032 1035
1033 // Load current lexical context from the stack frame. 1036 // Load current lexical context from the stack frame.
1034 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset)); 1037 mov(scratch1, Operand(ebp, StandardFrameConstants::kContextOffset));
1035 1038
1036 // When generating debug code, make sure the lexical context is set. 1039 // When generating debug code, make sure the lexical context is set.
1037 if (emit_debug_code()) { 1040 if (emit_debug_code()) {
1038 cmp(scratch, Immediate(0)); 1041 cmp(scratch1, Immediate(0));
1039 Check(not_equal, "we should not have an empty lexical context"); 1042 Check(not_equal, "we should not have an empty lexical context");
1040 } 1043 }
1041 // Load the native context of the current context. 1044 // Load the native context of the current context.
1042 int offset = 1045 int offset =
1043 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; 1046 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
1044 mov(scratch, FieldOperand(scratch, offset)); 1047 mov(scratch1, FieldOperand(scratch1, offset));
1045 mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); 1048 mov(scratch1, FieldOperand(scratch1, GlobalObject::kNativeContextOffset));
1046 1049
1047 // Check the context is a native context. 1050 // Check the context is a native context.
1048 if (emit_debug_code()) { 1051 if (emit_debug_code()) {
1049 push(scratch);
1050 // Read the first word and compare to native_context_map. 1052 // Read the first word and compare to native_context_map.
1051 mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); 1053 cmp(FieldOperand(scratch1, HeapObject::kMapOffset),
1052 cmp(scratch, isolate()->factory()->native_context_map()); 1054 isolate()->factory()->native_context_map());
1053 Check(equal, "JSGlobalObject::native_context should be a native context."); 1055 Check(equal, "JSGlobalObject::native_context should be a native context.");
1054 pop(scratch);
1055 } 1056 }
1056 1057
1057 // Check if both contexts are the same. 1058 // Check if both contexts are the same.
1058 cmp(scratch, FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); 1059 cmp(scratch1, FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset));
1059 j(equal, &same_contexts); 1060 j(equal, &same_contexts);
1060 1061
1061 // Compare security tokens, save holder_reg on the stack so we can use it 1062 // Compare security tokens, save holder_reg on the stack so we can use it
1062 // as a temporary register. 1063 // as a temporary register.
1063 // 1064 //
1064 // TODO(119): avoid push(holder_reg)/pop(holder_reg)
1065 push(holder_reg);
1066 // Check that the security token in the calling global object is 1065 // Check that the security token in the calling global object is
1067 // compatible with the security token in the receiving global 1066 // compatible with the security token in the receiving global
1068 // object. 1067 // object.
1069 mov(holder_reg, 1068 mov(scratch2,
1070 FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); 1069 FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset));
1071 1070
1072 // Check the context is a native context. 1071 // Check the context is a native context.
1073 if (emit_debug_code()) { 1072 if (emit_debug_code()) {
1074 cmp(holder_reg, isolate()->factory()->null_value()); 1073 cmp(scratch2, isolate()->factory()->null_value());
1075 Check(not_equal, "JSGlobalProxy::context() should not be null."); 1074 Check(not_equal, "JSGlobalProxy::context() should not be null.");
1076 1075
1077 push(holder_reg);
1078 // Read the first word and compare to native_context_map(), 1076 // Read the first word and compare to native_context_map(),
1079 mov(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); 1077 cmp(FieldOperand(scratch2, HeapObject::kMapOffset),
1080 cmp(holder_reg, isolate()->factory()->native_context_map()); 1078 isolate()->factory()->native_context_map());
1081 Check(equal, "JSGlobalObject::native_context should be a native context."); 1079 Check(equal, "JSGlobalObject::native_context should be a native context.");
1082 pop(holder_reg);
1083 } 1080 }
1084 1081
1085 int token_offset = Context::kHeaderSize + 1082 int token_offset = Context::kHeaderSize +
1086 Context::SECURITY_TOKEN_INDEX * kPointerSize; 1083 Context::SECURITY_TOKEN_INDEX * kPointerSize;
1087 mov(scratch, FieldOperand(scratch, token_offset)); 1084 mov(scratch1, FieldOperand(scratch1, token_offset));
1088 cmp(scratch, FieldOperand(holder_reg, token_offset)); 1085 cmp(scratch1, FieldOperand(scratch2, token_offset));
1089 pop(holder_reg);
1090 j(not_equal, miss); 1086 j(not_equal, miss);
1091 1087
1092 bind(&same_contexts); 1088 bind(&same_contexts);
1093 } 1089 }
1094 1090
1095 1091
1096 // Compute the hash code from the untagged key. This must be kept in sync 1092 // Compute the hash code from the untagged key. This must be kept in sync
1097 // with ComputeIntegerHash in utils.h. 1093 // with ComputeIntegerHash in utils.h.
1098 // 1094 //
1099 // Note: r0 will contain hash code 1095 // Note: r0 will contain hash code
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after
3097 j(greater, &no_info_available); 3093 j(greater, &no_info_available);
3098 cmp(MemOperand(scratch_reg, -AllocationSiteInfo::kSize), 3094 cmp(MemOperand(scratch_reg, -AllocationSiteInfo::kSize),
3099 Immediate(Handle<Map>(isolate()->heap()->allocation_site_info_map()))); 3095 Immediate(Handle<Map>(isolate()->heap()->allocation_site_info_map())));
3100 bind(&no_info_available); 3096 bind(&no_info_available);
3101 } 3097 }
3102 3098
3103 3099
3104 } } // namespace v8::internal 3100 } } // namespace v8::internal
3105 3101
3106 #endif // V8_TARGET_ARCH_IA32 3102 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698