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

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

Issue 3970005: Make Failure inherit from MaybeObject instead of Object. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 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') | src/x64/regexp-macro-assembler-x64.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 int3(); 308 int3();
309 } 309 }
310 310
311 311
312 void MacroAssembler::CallStub(CodeStub* stub) { 312 void MacroAssembler::CallStub(CodeStub* stub) {
313 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs 313 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs
314 Call(stub->GetCode(), RelocInfo::CODE_TARGET); 314 Call(stub->GetCode(), RelocInfo::CODE_TARGET);
315 } 315 }
316 316
317 317
318 Object* MacroAssembler::TryCallStub(CodeStub* stub) { 318 MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub) {
319 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs. 319 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs.
320 Object* result = stub->TryGetCode(); 320 MaybeObject* result = stub->TryGetCode();
321 if (!result->IsFailure()) { 321 if (!result->IsFailure()) {
322 call(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET); 322 call(Handle<Code>(Code::cast(result->ToObjectUnchecked())),
323 RelocInfo::CODE_TARGET);
323 } 324 }
324 return result; 325 return result;
325 } 326 }
326 327
327 328
328 void MacroAssembler::TailCallStub(CodeStub* stub) { 329 void MacroAssembler::TailCallStub(CodeStub* stub) {
329 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs 330 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs
330 Jump(stub->GetCode(), RelocInfo::CODE_TARGET); 331 Jump(stub->GetCode(), RelocInfo::CODE_TARGET);
331 } 332 }
332 333
333 334
334 Object* MacroAssembler::TryTailCallStub(CodeStub* stub) { 335 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub) {
335 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs. 336 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs.
336 Object* result = stub->TryGetCode(); 337 MaybeObject* result = stub->TryGetCode();
337 if (!result->IsFailure()) { 338 if (!result->IsFailure()) {
338 jmp(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET); 339 jmp(Handle<Code>(Code::cast(result->ToObjectUnchecked())),
340 RelocInfo::CODE_TARGET);
339 } 341 }
340 return result; 342 return result;
341 } 343 }
342 344
343 345
344 void MacroAssembler::StubReturn(int argc) { 346 void MacroAssembler::StubReturn(int argc) {
345 ASSERT(argc >= 1 && generating_stub()); 347 ASSERT(argc >= 1 && generating_stub());
346 ret((argc - 1) * kPointerSize); 348 ret((argc - 1) * kPointerSize);
347 } 349 }
348 350
(...skipping 23 matching lines...) Expand all
372 // there is no difference in using either key. 374 // there is no difference in using either key.
373 Integer32ToSmi(index, hash); 375 Integer32ToSmi(index, hash);
374 } 376 }
375 377
376 378
377 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { 379 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) {
378 CallRuntime(Runtime::FunctionForId(id), num_arguments); 380 CallRuntime(Runtime::FunctionForId(id), num_arguments);
379 } 381 }
380 382
381 383
382 Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id, 384 MaybeObject* MacroAssembler::TryCallRuntime(Runtime::FunctionId id,
383 int num_arguments) { 385 int num_arguments) {
384 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments); 386 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments);
385 } 387 }
386 388
387 389
388 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { 390 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
389 // If the expected number of arguments of the runtime function is 391 // If the expected number of arguments of the runtime function is
390 // constant, we check that the actual number of arguments match the 392 // constant, we check that the actual number of arguments match the
391 // expectation. 393 // expectation.
392 if (f->nargs >= 0 && f->nargs != num_arguments) { 394 if (f->nargs >= 0 && f->nargs != num_arguments) {
393 IllegalOperation(num_arguments); 395 IllegalOperation(num_arguments);
394 return; 396 return;
395 } 397 }
396 398
397 // TODO(1236192): Most runtime routines don't need the number of 399 // TODO(1236192): Most runtime routines don't need the number of
398 // arguments passed in because it is constant. At some point we 400 // arguments passed in because it is constant. At some point we
399 // should remove this need and make the runtime routine entry code 401 // should remove this need and make the runtime routine entry code
400 // smarter. 402 // smarter.
401 Set(rax, num_arguments); 403 Set(rax, num_arguments);
402 movq(rbx, ExternalReference(f)); 404 movq(rbx, ExternalReference(f));
403 CEntryStub ces(f->result_size); 405 CEntryStub ces(f->result_size);
404 CallStub(&ces); 406 CallStub(&ces);
405 } 407 }
406 408
407 409
408 Object* MacroAssembler::TryCallRuntime(Runtime::Function* f, 410 MaybeObject* MacroAssembler::TryCallRuntime(Runtime::Function* f,
409 int num_arguments) { 411 int num_arguments) {
410 if (f->nargs >= 0 && f->nargs != num_arguments) { 412 if (f->nargs >= 0 && f->nargs != num_arguments) {
411 IllegalOperation(num_arguments); 413 IllegalOperation(num_arguments);
412 // Since we did not call the stub, there was no allocation failure. 414 // Since we did not call the stub, there was no allocation failure.
413 // Return some non-failure object. 415 // Return some non-failure object.
414 return Heap::undefined_value(); 416 return Heap::undefined_value();
415 } 417 }
416 418
417 // TODO(1236192): Most runtime routines don't need the number of 419 // TODO(1236192): Most runtime routines don't need the number of
418 // arguments passed in because it is constant. At some point we 420 // arguments passed in because it is constant. At some point we
419 // should remove this need and make the runtime routine entry code 421 // should remove this need and make the runtime routine entry code
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 CPU::FlushICache(address_, size_); 2280 CPU::FlushICache(address_, size_);
2279 2281
2280 // Check that the code was patched as expected. 2282 // Check that the code was patched as expected.
2281 ASSERT(masm_.pc_ == address_ + size_); 2283 ASSERT(masm_.pc_ == address_ + size_);
2282 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2284 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2283 } 2285 }
2284 2286
2285 } } // namespace v8::internal 2287 } } // namespace v8::internal
2286 2288
2287 #endif // V8_TARGET_ARCH_X64 2289 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/regexp-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698