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

Side by Side Diff: src/ia32/virtual-frame-ia32.cc

Issue 6576024: (early draft) Strict mode - throw exception on assignment to read only property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Assign to read only property in strict mode. Created 9 years, 9 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/virtual-frame-ia32.h ('k') | src/ic.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 1031 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
1032 return RawCallCodeObject(ic, mode); 1032 return RawCallCodeObject(ic, mode);
1033 } 1033 }
1034 1034
1035 1035
1036 Result VirtualFrame::CallStoreIC(Handle<String> name, 1036 Result VirtualFrame::CallStoreIC(Handle<String> name,
1037 bool is_contextual, 1037 bool is_contextual,
1038 StrictModeFlag strict_mode) { 1038 StrictModeFlag strict_mode) {
1039 // Value and (if not contextual) receiver are on top of the frame. 1039 // Value and (if not contextual) receiver are on top of the frame.
1040 // The IC expects name in ecx, value in eax, and receiver in edx. 1040 // The IC expects name in ecx, value in eax, and receiver in edx.
1041 Handle<Code> ic(Builtins::builtin(strict_mode == kStrictMode 1041 Handle<Code> ic(Builtins::builtin(
1042 ? Builtins::StoreIC_Initialize_Strict 1042 strict_mode == kStrictMode ? Builtins::StoreIC_Initialize_Strict
1043 : Builtins::StoreIC_Initialize)); 1043 : Builtins::StoreIC_Initialize));
1044 1044
1045 Result value = Pop(); 1045 Result value = Pop();
1046 RelocInfo::Mode mode; 1046 RelocInfo::Mode mode;
1047 if (is_contextual) { 1047 if (is_contextual) {
1048 PrepareForCall(0, 0); 1048 PrepareForCall(0, 0);
1049 value.ToRegister(eax); 1049 value.ToRegister(eax);
1050 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 1050 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
1051 value.Unuse(); 1051 value.Unuse();
1052 mode = RelocInfo::CODE_TARGET_CONTEXT; 1052 mode = RelocInfo::CODE_TARGET_CONTEXT;
1053 } else { 1053 } else {
1054 Result receiver = Pop(); 1054 Result receiver = Pop();
1055 PrepareForCall(0, 0); 1055 PrepareForCall(0, 0);
1056 MoveResultsToRegisters(&value, &receiver, eax, edx); 1056 MoveResultsToRegisters(&value, &receiver, eax, edx);
1057 mode = RelocInfo::CODE_TARGET; 1057 mode = RelocInfo::CODE_TARGET;
1058 } 1058 }
1059 __ mov(ecx, name); 1059 __ mov(ecx, name);
1060 return RawCallCodeObject(ic, mode); 1060 return RawCallCodeObject(ic, mode);
1061 } 1061 }
1062 1062
1063 1063
1064 Result VirtualFrame::CallKeyedStoreIC() { 1064 Result VirtualFrame::CallKeyedStoreIC(StrictModeFlag strict_mode) {
1065 // Value, key, and receiver are on the top of the frame. The IC 1065 // Value, key, and receiver are on the top of the frame. The IC
1066 // expects value in eax, key in ecx, and receiver in edx. 1066 // expects value in eax, key in ecx, and receiver in edx.
1067 Result value = Pop(); 1067 Result value = Pop();
1068 Result key = Pop(); 1068 Result key = Pop();
1069 Result receiver = Pop(); 1069 Result receiver = Pop();
1070 PrepareForCall(0, 0); 1070 PrepareForCall(0, 0);
1071 if (!cgen()->allocator()->is_used(eax) || 1071 if (!cgen()->allocator()->is_used(eax) ||
1072 (value.is_register() && value.reg().is(eax))) { 1072 (value.is_register() && value.reg().is(eax))) {
1073 if (!cgen()->allocator()->is_used(eax)) { 1073 if (!cgen()->allocator()->is_used(eax)) {
1074 value.ToRegister(eax); 1074 value.ToRegister(eax);
(...skipping 23 matching lines...) Expand all
1098 __ xchg(eax, ecx); 1098 __ xchg(eax, ecx);
1099 } else { 1099 } else {
1100 __ xchg(eax, ecx); 1100 __ xchg(eax, ecx);
1101 __ xchg(eax, edx); 1101 __ xchg(eax, edx);
1102 } 1102 }
1103 value.Unuse(); 1103 value.Unuse();
1104 key.Unuse(); 1104 key.Unuse();
1105 receiver.Unuse(); 1105 receiver.Unuse();
1106 } 1106 }
1107 1107
1108 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); 1108 Handle<Code> ic(Builtins::builtin(
1109 strict_mode == kStrictMode ? Builtins::KeyedStoreIC_Initialize_Strict
1110 : Builtins::KeyedStoreIC_Initialize));
1109 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); 1111 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET);
1110 } 1112 }
1111 1113
1112 1114
1113 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, 1115 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode,
1114 int arg_count, 1116 int arg_count,
1115 int loop_nesting) { 1117 int loop_nesting) {
1116 // Function name, arguments, and receiver are on top of the frame. 1118 // Function name, arguments, and receiver are on top of the frame.
1117 // The IC expects the name in ecx and the rest on the stack and 1119 // The IC expects the name in ecx and the rest on the stack and
1118 // drops them all. 1120 // drops them all.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 } 1336 }
1335 UNREACHABLE(); 1337 UNREACHABLE();
1336 } 1338 }
1337 1339
1338 1340
1339 #undef __ 1341 #undef __
1340 1342
1341 } } // namespace v8::internal 1343 } } // namespace v8::internal
1342 1344
1343 #endif // V8_TARGET_ARCH_IA32 1345 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/virtual-frame-ia32.h ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698