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

Side by Side Diff: Source/bindings/v8/ExceptionState.cpp

Issue 105693002: Generate a bit less code to handle failed arity checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 m_exception.set(m_isolate, exception); 76 m_exception.set(m_isolate, exception);
77 } 77 }
78 78
79 void ExceptionState::throwTypeError(const String& message) 79 void ExceptionState::throwTypeError(const String& message)
80 { 80 {
81 ASSERT(m_isolate); 81 ASSERT(m_isolate);
82 m_code = TypeError; 82 m_code = TypeError;
83 setException(V8ThrowException::createTypeError(addExceptionContext(message), m_isolate)); 83 setException(V8ThrowException::createTypeError(addExceptionContext(message), m_isolate));
84 } 84 }
85 85
86 void ExceptionState::notEnoughArguments(int expected, int actual)
87 {
88 throwTypeError(ExceptionMessages::notEnoughArguments(expected, actual));
89 throwIfNeeded();
Mike West 2013/12/05 11:48:59 This is a change from the semantics we've set up f
sof 2013/12/05 12:01:32 It seems redundant to generate that much code at e
Mike West 2013/12/05 12:15:15 As long as we can assume that this is always calle
90 }
91
86 void TrackExceptionState::throwDOMException(const ExceptionCode& ec, const Strin g& message) 92 void TrackExceptionState::throwDOMException(const ExceptionCode& ec, const Strin g& message)
87 { 93 {
88 m_code = ec; 94 m_code = ec;
89 } 95 }
90 96
91 void TrackExceptionState::throwTypeError(const String&) 97 void TrackExceptionState::throwTypeError(const String&)
92 { 98 {
93 m_code = TypeError; 99 m_code = TypeError;
94 } 100 }
95 101
(...skipping 17 matching lines...) Expand all
113 processedMessage = ExceptionMessages::failedToGet(propertyName(), in terfaceName(), message); 119 processedMessage = ExceptionMessages::failedToGet(propertyName(), in terfaceName(), message);
114 else if (m_context == SetterContext) 120 else if (m_context == SetterContext)
115 processedMessage = ExceptionMessages::failedToSet(propertyName(), in terfaceName(), message); 121 processedMessage = ExceptionMessages::failedToSet(propertyName(), in terfaceName(), message);
116 } else if (!propertyName() && interfaceName() && m_context == ConstructionCo ntext) { 122 } else if (!propertyName() && interfaceName() && m_context == ConstructionCo ntext) {
117 processedMessage = ExceptionMessages::failedToConstruct(interfaceName(), message); 123 processedMessage = ExceptionMessages::failedToConstruct(interfaceName(), message);
118 } 124 }
119 return processedMessage; 125 return processedMessage;
120 } 126 }
121 127
122 } // namespace WebCore 128 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698