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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 146303003: Fix the context check in LoadGlobalFunctionPrototype (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/stub-cache-ia32.cc ('k') | no next file » | 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 __ movp(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); 238 __ movp(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
239 } 239 }
240 240
241 241
242 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype( 242 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
243 MacroAssembler* masm, 243 MacroAssembler* masm,
244 int index, 244 int index,
245 Register prototype, 245 Register prototype,
246 Label* miss) { 246 Label* miss) {
247 Isolate* isolate = masm->isolate(); 247 Isolate* isolate = masm->isolate();
248 // Check we're still in the same context.
249 __ Move(prototype, isolate->global_object());
250 __ cmpq(Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)),
251 prototype);
252 __ j(not_equal, miss);
253 // Get the global function with the given index. 248 // Get the global function with the given index.
254 Handle<JSFunction> function( 249 Handle<JSFunction> function(
255 JSFunction::cast(isolate->native_context()->get(index))); 250 JSFunction::cast(isolate->native_context()->get(index)));
251
252 // Check we're still in the same context.
253 Register scratch = prototype;
254 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX);
255 __ movp(scratch, Operand(rsi, offset));
256 __ movp(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset));
257 __ Cmp(Operand(scratch, Context::SlotOffset(index)), function);
258 __ j(not_equal, miss);
259
256 // Load its initial map. The global functions all have initial maps. 260 // Load its initial map. The global functions all have initial maps.
257 __ Move(prototype, Handle<Map>(function->initial_map())); 261 __ Move(prototype, Handle<Map>(function->initial_map()));
258 // Load the prototype from the initial map. 262 // Load the prototype from the initial map.
259 __ movp(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); 263 __ movp(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
260 } 264 }
261 265
262 266
263 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm, 267 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm,
264 Register receiver, 268 Register receiver,
265 Register scratch, 269 Register scratch,
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 // ----------------------------------- 1858 // -----------------------------------
1855 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 1859 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
1856 } 1860 }
1857 1861
1858 1862
1859 #undef __ 1863 #undef __
1860 1864
1861 } } // namespace v8::internal 1865 } } // namespace v8::internal
1862 1866
1863 #endif // V8_TARGET_ARCH_X64 1867 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698