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

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

Issue 151142: X64: Implement InstanceofStub. Prohibit zero-size code objects. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 5 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/x64/macro-assembler-x64.h ('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 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 CmpInstanceType(map, type); 392 CmpInstanceType(map, type);
393 } 393 }
394 394
395 395
396 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) { 396 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) {
397 cmpb(FieldOperand(map, Map::kInstanceTypeOffset), 397 cmpb(FieldOperand(map, Map::kInstanceTypeOffset),
398 Immediate(static_cast<int8_t>(type))); 398 Immediate(static_cast<int8_t>(type)));
399 } 399 }
400 400
401 401
402 void MacroAssembler::TryGetFunctionPrototype(Register function,
403 Register result,
404 Label* miss) {
405 // Check that the receiver isn't a smi.
406 testl(function, Immediate(kSmiTagMask));
407 j(zero, miss);
408
409 // Check that the function really is a function.
410 CmpObjectType(function, JS_FUNCTION_TYPE, result);
411 j(not_equal, miss);
412
413 // Make sure that the function has an instance prototype.
414 Label non_instance;
415 testb(FieldOperand(result, Map::kBitFieldOffset),
416 Immediate(1 << Map::kHasNonInstancePrototype));
417 j(not_zero, &non_instance);
418
419 // Get the prototype or initial map from the function.
420 movq(result,
421 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
422
423 // If the prototype or initial map is the hole, don't return it and
424 // simply miss the cache instead. This will allow us to allocate a
425 // prototype object on-demand in the runtime system.
426 Cmp(result, Factory::the_hole_value());
427 j(equal, miss);
428
429 // If the function does not have an initial map, we're done.
430 Label done;
431 CmpObjectType(result, MAP_TYPE, kScratchRegister);
432 j(not_equal, &done);
433
434 // Get the prototype from the initial map.
435 movq(result, FieldOperand(result, Map::kPrototypeOffset));
436 jmp(&done);
437
438 // Non-instance prototype: Fetch prototype from constructor field
439 // in initial map.
440 bind(&non_instance);
441 movq(result, FieldOperand(result, Map::kConstructorOffset));
442
443 // All done.
444 bind(&done);
445 }
446
402 447
403 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { 448 void MacroAssembler::SetCounter(StatsCounter* counter, int value) {
404 if (FLAG_native_code_counters && counter->Enabled()) { 449 if (FLAG_native_code_counters && counter->Enabled()) {
405 movq(kScratchRegister, ExternalReference(counter)); 450 movq(kScratchRegister, ExternalReference(counter));
406 movl(Operand(kScratchRegister, 0), Immediate(value)); 451 movl(Operand(kScratchRegister, 0), Immediate(value));
407 } 452 }
408 } 453 }
409 454
410 455
411 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { 456 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) {
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 push(rcx); 840 push(rcx);
796 841
797 // Clear the top frame. 842 // Clear the top frame.
798 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); 843 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address);
799 movq(kScratchRegister, c_entry_fp_address); 844 movq(kScratchRegister, c_entry_fp_address);
800 movq(Operand(kScratchRegister, 0), Immediate(0)); 845 movq(Operand(kScratchRegister, 0), Immediate(0));
801 } 846 }
802 847
803 848
804 } } // namespace v8::internal 849 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698